Skip to content

chore: create/update dockerignore #8

chore: create/update dockerignore

chore: create/update dockerignore #8

name: Build and Push Docker Images
on:
push:
branches:
- main
paths:
- "src/forge/**"
- "src/frontstage/**"
- "src/launchpad/**"
- "src/logify/**"
- "src/proxy/**"
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
directory:
- src/forge
- src/frontstage
- src/launchpad
- src/logify
- src/proxy
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# ECR
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
# aws-region: us-east-1
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
- name: Build and push Docker images
env:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
# Uncomment the following line when switching to ECR
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
DIR_NAME=$(basename ${{ matrix.directory }})
if [ "$DIR_NAME" = "frontstage" ]; then
docker build --build-arg NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=$NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY \
--build-arg NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in" \
--build-arg NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up" \
--build-arg NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL="/dashboard" \
--build-arg NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL="/dashboard" \
--build-arg CLERK_SECRET_KEY=$CLERK_SECRET_KEY \
-t "docker.io/vsramchaik/aether-$DIR_NAME" ${{ matrix.directory }}
else
docker build -t "docker.io/vsramchaik/aether-$DIR_NAME" ${{ matrix.directory }}
fi
docker push "docker.io/vsramchaik/aether-$DIR_NAME"
# Uncomment the following lines when switching to ECR
# ECR_REPOSITORY="$DIR_NAME"
# docker tag "docker.io/vsramchaik/aether-$DIR_NAME" "$ECR_REGISTRY/$ECR_REPOSITORY:latest"
# docker push "$ECR_REGISTRY/$ECR_REPOSITORY:latest"