Skip to content

Publish Docker image #5

Publish Docker image

Publish Docker image #5

name: Publish Docker image
# To maastrichtu-library GitHub Container Registry
# https://github.com/orgs/maastrichtu-library/packages
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'Dockerfile'
- '.github/workflows/publish-docker.yml'
schedule:
- cron: '0 3 * * 1'
# Monday at 3:00 GMT+1
env:
IMAGE_PULLED: postgres:latest
IMAGE_PUSHED: ghcr.io/maastrichtu-library/postgres:latest
jobs:
publish-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Log into GitHub Container Registry
# TODO: Create a token with `read:packages` and `write:packages` scopes
# And save it as an Actions secret CONTAINER_REGISTRY_GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Pull image from DockerHub
run: docker pull $IMAGE_PULLED
- name: Push image to GitHub Container Registry
run: |
docker tag $IMAGE_PULLED $IMAGE_PUSHED
docker push $IMAGE_PUSHED
# - name: Build image
# run: docker build . --file Dockerfile --tag $IMAGE_PUSHED