Skip to content

Commit

Permalink
Fix deployment.
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Nov 21, 2023
1 parent 8154200 commit 57d335d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
33 changes: 33 additions & 0 deletions .deploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.9"
services:
app:
image: ghcr.io/${IMAGE_REPO}:${RELEASE_VERSION}
restart: always
ports:
- "8080"
container_name: ${APP_NAME}_app
environment:
VIRTUAL_HOST: ${HOST_DOMAIN}
VIRTUAL_PORT: 8080 # New default ASP.NET port -> https://learn.microsoft.com/en-us/dotnet/core/compatibility/containers/8.0/aspnet-port
LETSENCRYPT_HOST: ${HOST_DOMAIN}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
volumes:
- app-mydb:/app/App_Data

app-migration:
image: ghcr.io/${IMAGE_REPO}:${RELEASE_VERSION}
restart: "no"
container_name: ${APP_NAME}_app_migration
profiles:
- migration
command: --AppTasks=migrate
volumes:
- app-mydb:/app/App_Data

networks:
default:
external: true
name: nginx

volumes:
app-mydb:
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ jobs:
echo "IMAGE_REPO=${{ env.image_repository_name }}" >> .env
echo "RELEASE_VERSION=${{ env.TAG_NAME }}" >> .env
# Copy only the docker-compose.yml to remote server home folder
- name: copy files to target server via scp
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_API }}
username: ${{ secrets.DEPLOY_USERNAME }}
port: 22
key: ${{ secrets.DEPLOY_KEY }}
source: "./docker-compose.yml,./docker-compose.prod.yml,./.env"
strip_components: 2
source: "./.deploy/docker-compose.yml,./.deploy/.env"
target: "~/.deploy/${{ github.event.repository.name }}/"

- name: Run remote db migrations
Expand All @@ -168,8 +168,8 @@ jobs:
script: |
echo $APPTOKEN | docker login ghcr.io -u $USERNAME --password-stdin
cd ~/.deploy/${{ github.event.repository.name }}
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml pull
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml up app-migration
docker compose pull
docker compose up app-migration
# Deploy Docker image with your application using `docker compose up` remotely
- name: remote docker-compose up via ssh
Expand All @@ -186,5 +186,5 @@ jobs:
script: |
echo $APPTOKEN | docker login ghcr.io -u $USERNAME --password-stdin
cd ~/.deploy/${{ github.event.repository.name }}
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml pull
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml up app -d
docker compose pull
docker compose up app -d

0 comments on commit 57d335d

Please sign in to comment.