Update deploy.yml

This commit is contained in:
TheThomaas 2023-05-26 22:09:03 +02:00
parent 2010768c0a
commit 7bc00225af

View file

@ -4,7 +4,9 @@ on:
push:
branches:
- main
env:
CONTAINER_NAME: 11ty-workflow-example
CONTAINER_IMAGE: thethomaas/11ty-workflow-example:latest
jobs:
deploy:
runs-on: ubuntu-latest
@ -19,16 +21,12 @@ jobs:
npm run production
- name: Build Docker image
run: docker build -t thethomaas/11ty-workflow-example:latest --build-arg SITE_DIRECTORY=dist .
- run: |
echo ${{secrets.CONTAINER_NAME}} | sed 's/./& /g'
echo ${{secrets.CONTAINER_IMAGE}} | sed 's/./& /g'
run: docker build -t $CONTAINER_IMAGE --build-arg SITE_DIRECTORY=dist .
- name: Remove old Docker container
run: |
docker stop dev || true && docker rm dev || true
docker stop $CONTAINER_NAME || true && docker rm $CONTAINER_NAME || true
- name: Run Docker container
run: |
docker run -d -p 8086:3000 --name dev thethomaas/11ty-workflow-example:latest
docker run -d -p 8086:3000 --name $CONTAINER_NAME $CONTAINER_IMAGE