✨ feat: update Docker setup and enhance error handling (#19)
This commit is contained in:
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
@@ -38,6 +38,7 @@ jobs:
|
||||
CONTAINER_NAME="nextjs-$DEPLOY_ENV"
|
||||
IMAGE_NAME="my-nextjs-app:$DEPLOY_ENV"
|
||||
NEW_CONTAINER_NAME="$CONTAINER_NAME-new"
|
||||
NETWORK_NAME="big-bear-ghost_ghost-network"
|
||||
|
||||
# Remove existing temporary container, if any
|
||||
if [ "$(docker ps -aq -f name=$NEW_CONTAINER_NAME)" ]; then
|
||||
@@ -46,8 +47,9 @@ jobs:
|
||||
fi
|
||||
|
||||
# Start the new container on a temporary internal port
|
||||
docker run -d --name "$NEW_CONTAINER_NAME" -p 40000:3000 \
|
||||
docker run -d --name "$NEW_CONTAINER_NAME" --network $NETWORK_NAME -p 40000:3000 \
|
||||
-e GHOST_API_KEY="${{ secrets.GHOST_API_KEY }}" \
|
||||
-e NEXT_PUBLIC_BASE_URL="https://dki.one" \
|
||||
$IMAGE_NAME
|
||||
|
||||
# Wait to ensure the new container is running
|
||||
@@ -66,8 +68,9 @@ jobs:
|
||||
docker rm "$NEW_CONTAINER_NAME" || true
|
||||
|
||||
# Start the container with the desired name and port
|
||||
docker run -d --name "$CONTAINER_NAME" -p $PORT:3000 \
|
||||
docker run -d --name "$CONTAINER_NAME" --network $NETWORK_NAME -p $PORT:3000 \
|
||||
-e GHOST_API_KEY="${{ secrets.GHOST_API_KEY }}" \
|
||||
-e NEXT_PUBLIC_BASE_URL="https://dki.one" \
|
||||
$IMAGE_NAME
|
||||
else
|
||||
echo "New container failed to start."
|
||||
|
||||
Reference in New Issue
Block a user