Browse Source

Add Docker stuff

Robert Marshall 3 years ago
parent
commit
fa3847a5e8
2 changed files with 17 additions and 36 deletions
  1. 5 36
      .drone.yml
  2. 12 0
      Dockerfile

+ 5 - 36
.drone.yml

@@ -4,44 +4,13 @@ name: default
 clone:
   skip_verify: true
 
-volumes:
-- name: output
-  host:
-    path: /var/www/Api.Mailboxes
-
 steps:
-- name: build and publish
-  image: mcr.microsoft.com/dotnet/sdk:5.0
-  volumes:
-  - name: output
-    path: /output
-  environment:
-    ConnectionString:
-      from_secret: ConnectionString
-    AuthEndpoint:
-      from_secret: AuthEndpoint
-    AuthApiKey:
-      from_secret: AuthApiKey
-  commands:
-  - chmod +x ./build.sh
-  - ./build.sh
-  - sed -i "s/<DatabaseConnectionString>/$ConnectionString/g" output/appsettings.json
-  - sed -i "s/<AuthEndpoint>/$AuthEndpoint/g" output/appsettings.json
-  - sed -i "s/<AuthApiKey>/$AuthApiKey/g" output/appsettings.json
-  - cp api.mailboxes.service output/
-  - cp -r ./output/* /output
-- name: restart service
-  privileged: true
-  image: appleboy/drone-ssh
+- name: docker
+  image: plugins/docker
   settings:
-    host: 192.168.1.3
-    username:
-      from_secret: ssh_user
-    password:
-      from_secret: ssh_password
-    script:
-    - systemctl daemon-reload
-    - service api.mailboxes restart
+    repo: docker.robware.uk/api.projects
+    registry: docker.robware.uk
+    tags: latest
 - name: notify
   image: drillster/drone-email
   settings:

+ 12 - 0
Dockerfile

@@ -0,0 +1,12 @@
+FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build-env
+WORKDIR /app
+COPY . ./
+RUN ./build.sh
+RUN sed -i "s/<AuthEndpoint>/${AuthEndpoint}/g" output/appsettings.json
+RUN sed -i "s/<AuthApiKey>/${AuthApiKey}/g" output/appsettings.json
+RUN sed -i "s/<DatabaseConnectionString>/${ConnectionString}/g" output/appsettings.json
+
+FROM mcr.microsoft.com/dotnet/aspnet:3.1
+WORKDIR /app
+COPY --from=build-env /app/output .
+ENTRYPOINT ["dotnet", "Robware.Api.Mailboxes.dll"]