Pass action env variables as script args

This commit is contained in:
Maciej Pędzich 2024-04-06 11:33:32 +02:00
parent 5ea13d4bee
commit 454e2e8274
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D
2 changed files with 6 additions and 1 deletions

View File

@ -11,4 +11,4 @@ jobs:
- name: Build Docker image
run: docker build -t maciejpedzi.ch:latest .
- name: Rerun website's Docker container
run: chmod +x ./rerun-container.sh && ./rerun-container.sh
run: chmod +x ./rerun-container.sh && ./rerun-container.sh ${{ env.CONTAINER_NAME }} ${{ env.PORT_PAIR }} ${{ env.NETWORK_NAME }} ${{ env.IMAGE_TAG }}

View File

@ -1,5 +1,10 @@
#!/usr/bin/sh
CONTAINER_NAME = $1;
PORT_PAIR = $2;
NETWORK_NAME = $3;
IMAGE_TAG = $4;
docker stop $CONTAINER_NAME && \
docker container rm $(docker ps -aqf "name=$CONTAINER_NAME") && \
docker run -d -p $PORT_PAIR --netwok $NETWORK_NAME --name $CONTAINER_NAME $IMAGE_TAG