Skip to content

Commit

Permalink
docker image experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmegatelo committed Jan 21, 2025
1 parent 70f608d commit 3978981
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:

jobs:
build:
name: Build image
name: Build the web service image
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@master
- run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{ secrets.GHCR_TOKEN }}
- run: docker build -f ./infra/production/django/Dockerfile -t ghcr.io/$GITHUB_ACTOR/walter:latest -t ghcr.io/$GITHUB_ACTOR/walter:$GITHUB_SHA .
- run: docker image push ghcr.io/$GITHUB_ACTOR/walter:$GITHUB_SHA
- run: docker image push ghcr.io/$GITHUB_ACTOR/walter:latest
- run: docker build -f ./infra/production/django/Dockerfile -t ghcr.io/$GITHUB_ACTOR/walter-web:latest -t ghcr.io/$GITHUB_ACTOR/walter-web:$GITHUB_SHA .
- run: docker image push ghcr.io/$GITHUB_ACTOR/walter-web:$GITHUB_SHA
- run: docker image push ghcr.io/$GITHUB_ACTOR/walter-web:latest

deploy:
name: Deploy
Expand Down Expand Up @@ -59,4 +59,4 @@ jobs:
- run: scp -o StrictHostKeyChecking=no -i ${{ env.SSH_KEY_PATH }} -r $(pwd)/* ${{ secrets.PRODUCTION_SSH_USERNAME }}@${{ secrets.PRODUCTION_SSH_HOST }}:/home/walter/walter
- run: scp -o StrictHostKeyChecking=no -i ${{ env.SSH_KEY_PATH }} .env ${{ secrets.PRODUCTION_SSH_USERNAME }}@${{ secrets.PRODUCTION_SSH_HOST }}:/home/walter/walter/.env
- run: scp -o StrictHostKeyChecking=no -i ${{ env.SSH_KEY_PATH }} docker-compose.prod.yml ${{ secrets.PRODUCTION_SSH_USERNAME }}@${{ secrets.PRODUCTION_SSH_HOST }}:/home/walter/walter/docker-compose.prod.yml
- run: ssh -i ${{ env.SSH_KEY_PATH }} ${{ secrets.PRODUCTION_SSH_USERNAME }}@${{ secrets.PRODUCTION_SSH_HOST }} "cd /home/walter/walter && docker login ghcr.io -u $GITHUB_ACTOR -p ${{ secrets.GHCR_TOKEN }} && docker pull ghcr.io/$GITHUB_ACTOR/walter:$GITHUB_SHA && docker compose -f docker-compose.prod.yml up -d --build && docker system prune --all --force"
- run: ssh -i ${{ env.SSH_KEY_PATH }} ${{ secrets.PRODUCTION_SSH_USERNAME }}@${{ secrets.PRODUCTION_SSH_HOST }} "cd /home/walter/walter && docker login ghcr.io -u $GITHUB_ACTOR -p ${{ secrets.GHCR_TOKEN }} && docker pull ghcr.io/$GITHUB_ACTOR/walter-web:$GITHUB_SHA && docker compose -f docker-compose.prod.yml up -d && docker system prune --all --force"
4 changes: 1 addition & 3 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ services:
- ./certbot/conf/:/etc/letsencrypt/:rw

web:
build:
context: .
dockerfile: infra/production/django/Dockerfile
image: ghcr.io/mrmegatelo/walter:${GITHUB_SHA:-latest}
command: /start
volumes:
- staticfiles:/app/staticfiles
Expand Down

0 comments on commit 3978981

Please sign in to comment.