From 09cdc843671599450980ab0c1cb469e1e572d15e Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Sun, 10 Apr 2022 13:41:28 +0100 Subject: [PATCH] Add Docker stuff --- .drone.yml | 37 ++++++------------------------------- Dockerfile | 10 ++++++++++ 2 files changed, 16 insertions(+), 31 deletions(-) create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml index 7323df3..cce7d6d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,38 +4,13 @@ name: default clone: skip_verify: true -volumes: -- name: output - host: - path: /var/www/Api.Auth - steps: -- name: build and publish - image: mcr.microsoft.com/dotnet/core/sdk:3.1 - volumes: - - name: output - path: /output - environment: - ConnectionString: - from_secret: ConnectionString - commands: - - chmod +x ./build.sh - - ./build.sh - - sed -i "s//$ConnectionString/g" output/appsettings.json - - cp api.auth.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.auth restart + repo: docker.robware.uk/api.auth + registry: docker.robware.uk + tags: latest - name: notify image: drillster/drone-email settings: @@ -45,4 +20,4 @@ steps: when: status: - changed - - failure \ No newline at end of file + - failure diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1d6500a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build-env +WORKDIR /app +COPY . ./ +RUN ./build.sh +RUN sed -i "s//${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.Auth.dll"]