Add Docker stuff

This commit is contained in:
Robert Marshall 2022-04-10 13:41:28 +01:00
parent 8f3ea03d75
commit 09cdc84367
2 changed files with 16 additions and 31 deletions

View file

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

10
Dockerfile Normal file
View file

@ -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/<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.Auth.dll"]