Chore/dependabot updates #30
Workflow file for this run
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 for Github Container Registry | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
env: | |
PG_PASSWORD: ${{ secrets.PG_PASSWORD }} | |
PG_DATABASE: ${{ secrets.PG_DATABASE }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: ~/.docker | |
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_PAT }} | |
- name: Build and push Docker image | |
run: | | |
# Build and push PostgreSQL service image | |
docker pull postgres:16.1 | |
docker tag postgres:16.1 ghcr.io/${{ github.repository_owner }}/postgres:16.1 | |
docker push ghcr.io/${{ github.repository_owner }}/postgres:16.1 | |
# Build and push Server service image | |
docker-compose -f docker-compose.yml build server | |
docker tag lost-and-found-server-dev:tag-v1.0.0 ghcr.io/${{ github.repository_owner }}/lost-and-found-server-dev:tag-v1.0.0 | |
docker push ghcr.io/${{ github.repository_owner }}/lost-and-found-server-dev:tag-v1.0.0 | |
# Build and push Client service image | |
docker-compose -f docker-compose.yml build client | |
docker tag lost-and-found-client-dev:tag-v1.0.0 ghcr.io/${{ github.repository_owner }}/lost-and-found-client-dev:tag-v1.0.0 | |
docker push ghcr.io/${{ github.repository_owner }}/lost-and-found-client-dev:tag-v1.0.0 |