Hi again, so if there is anyone who see this question and look for guidance, I took the foolowing approach. I build and upload the container in the first step and then deploy it with docker-compose up
. Dockerfile does the app build and test during the first step. So its like pipeline inside pipeline.
steps:
- label: "Create container build"
command: ./devops/cd/image.sh
env:
NODE_ENV: production
CONTAINER_CONN_STR: ghcr.io/path/to/repo
- wait
- label: "Deploy"
command: ./devops/cd/deploy.sh
concurrency: 1
concurrency_group: 'path/to/repo/deploy'
env:
NODE_ENV: production
CONTAINER_CONN_STR: ghcr.io/path/to/repo
APP_PORT: 3030
Dockerfile runs build and test stages:
FROM node:18-alpine3.17 as build
RUN ...
FROM build as test
RUN ...
FROM test as prod
RUN ...
CMD npm run fetch-env && npm run prod