Docker Image CI #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
workflow_run: | |
workflows: ["End-to-End Testing"] | |
types: | |
- completed | |
jobs: | |
build: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} # Check that the previous workflow was successful | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Step 1: Log in to Docker Hub | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
# Step 3: Build the Docker image with secrets | |
- name: Build the Docker image | |
run: | | |
docker build . \ | |
--file Dockerfile \ | |
--tag raisehub_fe:latest \ | |
# Step 4: Tag the Docker image with the repository name | |
- name: Tag the Docker image | |
run: | | |
docker tag raisehub_fe:latest ${{ secrets.DOCKER_USERNAME }}/raisehub_frontend:latest | |
# Step 5: Push the Docker image | |
- name: Push the Docker image | |
run: | | |
docker push ${{ secrets.DOCKER_USERNAME }}/raisehub_frontend:latest | |
# Step 6: Run the Docker container with secrets | |
- name: Run the Docker container | |
run: | | |
docker run -d \ | |
-e AWS_BUCKET_NAME=${{ secrets.AWS_BUCKET_NAME }} \ | |
-e AWS_BUCKET_REGION=${{ secrets.AWS_BUCKET_REGION }} \ | |
-e AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }} \ | |
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | |
-p 3000:3000 \ | |
raisehub_fe:latest |