Update docker-image.yml #2
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: | |
push: | |
branches: [ "main" ] | |
env: | |
IMAGE_NAME_API: ontario-park-audio-api | |
IMAGE_NAME_FRONTEND: ontario-park-audio-frontend | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: docker-compose up --build -d | |
- name: Log into GitHub Container Registry | |
run: echo "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push image to GitHub Container Registry | |
run: | | |
IMAGE_ID_API=ghcr.io/project-24-ontario-parks-T/$IMAGE_NAME_API | |
echo IMAGE_ID_API=$IMAGE_ID_API | |
docker tag $IMAGE_NAME $IMAGE_ID_API:latest | |
docker push $IMAGE_ID_API:latest | |
IMAGE_ID_FRONTEND=ghcr.io/project-24-ontario-parks-T/$IMAGE_NAME_FRONTEND | |
echo IMAGE_ID_FRONTEND=$IMAGE_ID_FRONTEND | |
docker tag $IMAGE_NAME $IMAGE_ID_FRONTEND:latest | |
docker push $IMAGE_ID_FRONTEND:latest |