upgrade packages #34
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
# Copied from https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions | |
name: Create and publish a Docker image | |
on: | |
push: | |
branches: ['main'] | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build-test-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push builder Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
push: true | |
target: builder | |
tags: ${{ env.REGISTRY }}/tomgobravo/tourist-builder:main | |
# Run tests before pushing tourist-production:latest. Based on | |
# https://docs.docker.com/build/ci/github-actions/test-before-push/ | |
- name: Run tests in builder Docker image | |
run: | | |
docker run --rm -w /app ${{ env.REGISTRY }}/tomgobravo/tourist-builder:main python -m pytest tourist/tests | |
- name: Build and push production Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
push: true | |
target: production | |
tags: ${{ env.REGISTRY }}/tomgobravo/tourist-production:latest |