-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Take a look at this build script as an example. There are a few differences/needed improvements to make.
Changes:
- We don't need the build-arg flags
- The
-targ should beotb - References to
becket-data-apion lines 19 and 22 should be replaced withotb
Improvements:
We should set the image tag, AWS_ECS_CLUSTER/SERVICE vars based on the branch. At the top we should add something that looks like:
TAG=$([ "$BRANCH" == "main" ] && echo "stable" || echo "latest")For the AWS_ECS_CLUSTER var, we will have GitHub secrets for both dev and pord that will be base and environment vars to the build script. So like the tag, we will need to add something like:
AWS_ECS_CLUSTER=$([ "$BRANCH" == "main" ] && echo $AWS_ECS_CLUSTER_PROD || echo $AWS_ECS_CLUSTER_DEV)You can add another one for AWS_ECS_SERVICE.
The lines that tag and push the image should be updated to use the dynamically set set tag, e.g.
docker tag otb "${AWS_ECR}/otb:${TAG}"Deploy Workflow
Again, using the beckett-data-api workflows as an example, you can rework the this bit for our purposes here.
- Chage the settings for the cluster and service vars, as in:
AWS_ECS_CLUSTER_DEV: ${{ secrets.AWS_ECS_CLUSTER_DEV }}- We don't need the RAILS_MASTER_KEY or REDIS_URL here.
- You need to add the develop branch to the list of branches.
Create and ENTRYPOINT Script for the Docker Build
Again with the beckett-data-api example, the Dockerfile uses an entrypoint script instead of a CMD. We don't need the sidekiq bit for OTB, but it's helpful to be able to run the migrations on each deploy.