File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 username : ${{ secrets.DOCKER_HUB_USERNAME }}
2222 password : ${{ secrets.DOCKER_HUB_TOKEN }}
2323
24- - name : Build Docker image
25- uses : docker/build-push-action@v5
26- with :
27- context : .
28- file : ./Dockerfile
29- push : false
30- tags : ${{ secrets.DOCKER_HUB_USERNAME }}/commit-api:latest
31-
32- - name : Create .env file from secret
33- run : echo "${{ secrets.ENV_FILE }}" > .env
34-
35- - name : Run container and check if it stays up for 5 seconds
36- run : |
37- docker run -d --name test-container \
38- -e FIREBASE_SERVICE_ACCOUNT_BASE64="${{ secrets.FIREBASE_SERVICE_ACCOUNT_BASE64 }}" \
39- -e FIREBASE_SERVICE_ACCOUNT_PATH="/app/config/service-account-key.json" \
40- ${{ secrets.DOCKER_HUB_USERNAME }}/commit-api:latest \
41- /bin/sh -c "mkdir -p /app/config && echo \$FIREBASE_SERVICE_ACCOUNT_BASE64 | base64 -d > /app/config/service-account-key.json && node src/index.js"
42- sleep 5
43- CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' test-container)
44- docker logs test-container
45- docker stop test-container
46- docker rm test-container
47- if [ "$CONTAINER_STATUS" != "true" ]; then
48- echo "Container exited too early! Failing the build."
49- exit 1
50- fi
51-
52- - name : Push Docker image
24+ - name : Build and push Docker image
5325 uses : docker/build-push-action@v5
5426 with :
5527 context : .
You can’t perform that action at this time.
0 commit comments