Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Bundle of Docker Deploy Improvements #676

Merged
merged 12 commits into from
Nov 27, 2023
Prev Previous commit
Next Next commit
feat: build github workflow images with metadata
AlpacaFur committed Nov 24, 2023
commit ea74c8cae70837f1c55cef45611c85d2e61af6d9
4 changes: 2 additions & 2 deletions .github/workflows/aws-cd.yml
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ jobs:
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f infrastructure/prod/Dockerfile.server .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg=\"COMMIT=$IMAGE_TAG\" --build-arg=\"BUILD_TIMESTAMP=$(date +%s)\" --build-arg=\"COMMIT_MESSAGE=$(git --no-pager show -s --format=%s)\" -f infrastructure/prod/Dockerfile.server .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT

@@ -49,7 +49,7 @@ jobs:
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f infrastructure/prod/Dockerfile.app .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg=\"COMMIT=$IMAGE_TAG\" --build-arg=\"BUILD_TIMESTAMP=$(date +%s)\" --build-arg=\"COMMIT_MESSAGE=$(git --no-pager show -s --format=%s)\" -f infrastructure/prod/Dockerfile.app .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT

8 changes: 1 addition & 7 deletions infrastructure/prod/Dockerfile.server
Original file line number Diff line number Diff line change
@@ -15,13 +15,6 @@ RUN yarn install > /dev/null
COPY packages/api-v2 packages/api-v2
COPY packages/common packages/common

ARG COMMIT
ARG COMMIT_MESSAGE
ARG BUILD_TIMESTAMP

ENV COMMIT_HASH $COMMIT
ENV COMMIT_MESSAGE $COMMIT_MESSAGE

# Build server and common dependency
RUN yarn packages/common build
RUN yarn packages/api-v2 build
@@ -36,6 +29,7 @@ ARG BUILD_TIMESTAMP
ENV NODE_ENV production
ENV COMMIT_HASH $COMMIT
ENV COMMIT_MESSAGE $COMMIT_MESSAGE
ENV BUILD_TIMESTAMP $BUILD_TIMESTAMP

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nestjs