Add automatic push to GHCR and dockerhub on push to master and set GHCR default
This commit is contained in:
parent
73063ff233
commit
8940703616
|
@ -0,0 +1,241 @@
|
||||||
|
name: Build and push docker images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-ckan-2-9:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx
|
||||||
|
|
||||||
|
- name: Get docker tag for Alpine image
|
||||||
|
id: alpine
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.9/Dockerfile)"
|
||||||
|
|
||||||
|
- name: Build and push CKAN 2.9 alpine
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/ckan/2.9
|
||||||
|
file: ./images/ckan/2.9/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/ckan:${{ steps.alpine.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/ckan:${{ steps.alpine.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
- name: Get docker tag for Ubuntu image
|
||||||
|
id: ubuntu
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.9/Dockerfile.focal)"
|
||||||
|
|
||||||
|
- name: Build and push CKAN 2.9 ubuntu
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/ckan/2.9
|
||||||
|
file: ./images/ckan/2.9/Dockerfile.focal
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
build-ckan-2-8:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Get docker tag for Alpine image
|
||||||
|
id: alpine
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.8/Dockerfile)"
|
||||||
|
|
||||||
|
- name: Build and push CKAN 2.8 alpine
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/ckan/2.8
|
||||||
|
file: ./images/ckan/2.8/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/ckan:${{ steps.alpine.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/ckan:${{ steps.alpine.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
- name: Get docker tag for Ubuntu image
|
||||||
|
id: ubuntu
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.8/Dockerfile.focal)"
|
||||||
|
|
||||||
|
- name: Build and push CKAN 2.8 ubuntu
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/ckan/2.8
|
||||||
|
file: ./images/ckan/2.8/Dockerfile.focal
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
build-ckan-2-7:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Get docker tag for Alpine image
|
||||||
|
id: alpine
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.7/Dockerfile)"
|
||||||
|
|
||||||
|
- name: Build and push CKAN 2.7 alpine
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/ckan/2.7
|
||||||
|
file: ./images/ckan/2.7/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/ckan:${{ steps.alpine.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/ckan:${{ steps.alpine.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
- name: Get docker tag for Ubuntu image
|
||||||
|
id: ubuntu
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.7/Dockerfile.focal)"
|
||||||
|
|
||||||
|
- name: Build CKAN 2.7 ubuntu
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/ckan/2.7
|
||||||
|
file: ./images/ckan/2.7/Dockerfile.focal
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
build-ckan-datapusher:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Get docker tag for datapusher image
|
||||||
|
id: datapusher
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/datapusher/Dockerfile)"
|
||||||
|
|
||||||
|
- name: Build and push CKAN datapusher
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/datapusher
|
||||||
|
file: ./images/datapusher/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/datapusher:${{ steps.datapusher.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/datapusher:${{ steps.datapusher.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
|
@ -3,7 +3,6 @@ name: PR Checks
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: master
|
branches: master
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-ckan-2-9:
|
build-ckan-2-9:
|
||||||
|
|
12
Readme.md
12
Readme.md
|
@ -8,6 +8,10 @@ We build and publish docker images built using this repository to Dockerhub:
|
||||||
- [CKAN docker images](https://hub.docker.com/r/keitaro/ckan).
|
- [CKAN docker images](https://hub.docker.com/r/keitaro/ckan).
|
||||||
- [Datapusher docker images](https://hub.docker.com/r/keitaro/ckan-datapusher)
|
- [Datapusher docker images](https://hub.docker.com/r/keitaro/ckan-datapusher)
|
||||||
|
|
||||||
|
and Github Container Registry:
|
||||||
|
- [CKAN docker images on GHCR](https://github.com/orgs/keitaroinc/packages/container/package/ckan)
|
||||||
|
- [Datapusher docker images on GHCR](https://github.com/orgs/keitaroinc/packages/container/package/datapusher)
|
||||||
|
|
||||||
Looking to run CKAN on Kubernetes? Check out our [CKAN Helm Chart](https://github.com/keitaroinc/ckan-helm)!
|
Looking to run CKAN on Kubernetes? Check out our [CKAN Helm Chart](https://github.com/keitaroinc/ckan-helm)!
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
@ -40,7 +44,7 @@ We recommend to use a multi-stage approach to extend the docker images that we p
|
||||||
###################
|
###################
|
||||||
### Extensions ####
|
### Extensions ####
|
||||||
###################
|
###################
|
||||||
FROM keitaro/ckan:2.9.1 as extbuild
|
FROM ghcr.io/keitaroinc/ckan:2.9.1 as extbuild
|
||||||
|
|
||||||
# Switch to the root user
|
# Switch to the root user
|
||||||
USER root
|
USER root
|
||||||
|
@ -54,7 +58,7 @@ RUN pip wheel --wheel-dir=/wheels git+https://github.com/acmecorp/ckanext-acme@0
|
||||||
############
|
############
|
||||||
### MAIN ###
|
### MAIN ###
|
||||||
############
|
############
|
||||||
FROM keitaro/ckan:2.9.1
|
FROM ghcr.io/keitaroinc/ckan:2.9.1
|
||||||
|
|
||||||
# Add the custom extensions to the plugins list
|
# Add the custom extensions to the plugins list
|
||||||
ENV CKAN__PLUGINS envvars image_view text_view recline_view datastore datapusher acme
|
ENV CKAN__PLUGINS envvars image_view text_view recline_view datastore datapusher acme
|
||||||
|
@ -84,9 +88,9 @@ You can add scripts to CKAN custom images and copy them to the *docker-afterinit
|
||||||
## Build
|
## Build
|
||||||
To build a CKAN image run:
|
To build a CKAN image run:
|
||||||
```sh
|
```sh
|
||||||
docker build --tag keitaro/ckan:2.9.1 images/ckan/2.9
|
docker build --tag ghcr.io/keitaroinc/ckan:2.9.1 images/ckan/2.9
|
||||||
```
|
```
|
||||||
The –-tag keitaro/ckan:2.9.1 flag sets the image name to ketiaro/ckan:2.9.1 and 'images/ckan/2.9' at the end tells docker build to use the context into the specified directory where the Dockerfile and related contents are.
|
The –-tag ghcr.io/keitaroinc/ckan:2.9.1 flag sets the image name to ghcr.io/keitaroinc/ckan:2.9.1 and 'images/ckan/2.9' at the end tells docker build to use the context into the specified directory where the Dockerfile and related contents are.
|
||||||
|
|
||||||
## Upload to DockerHub
|
## Upload to DockerHub
|
||||||
>*It's recommended to upload built images to DockerHub*
|
>*It's recommended to upload built images to DockerHub*
|
||||||
|
|
|
@ -9,7 +9,7 @@ volumes:
|
||||||
services:
|
services:
|
||||||
ckan:
|
ckan:
|
||||||
container_name: ckan
|
container_name: ckan
|
||||||
image: keitaro/ckan:${CKAN_VERSION}
|
image: ghcr.io/keitaroinc/ckan:${CKAN_VERSION}
|
||||||
networks:
|
networks:
|
||||||
- frontend
|
- frontend
|
||||||
- backend
|
- backend
|
||||||
|
@ -34,7 +34,7 @@ services:
|
||||||
|
|
||||||
datapusher:
|
datapusher:
|
||||||
container_name: datapusher
|
container_name: datapusher
|
||||||
image: keitaro/ckan-datapusher:${DATAPUSHER_VERSION}
|
image: ghcr.io/keitaroinc/datapusher:${DATAPUSHER_VERSION}
|
||||||
networks:
|
networks:
|
||||||
- frontend
|
- frontend
|
||||||
- backend
|
- backend
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
###################
|
###################
|
||||||
### Extensions ####
|
### Extensions ####
|
||||||
###################
|
###################
|
||||||
FROM keitaro/ckan:2.9.1 as extbuild
|
FROM ghcr.io/keitaroinc/ckan:2.9.1 as extbuild
|
||||||
|
|
||||||
# Locations and tags, please use specific tags or revisions
|
# Locations and tags, please use specific tags or revisions
|
||||||
ENV HARVEST_GIT_URL=https://github.com/ckan/ckanext-harvest
|
ENV HARVEST_GIT_URL=https://github.com/ckan/ckanext-harvest
|
||||||
|
@ -28,7 +28,7 @@ USER ckan
|
||||||
############
|
############
|
||||||
### MAIN ###
|
### MAIN ###
|
||||||
############
|
############
|
||||||
FROM keitaro/ckan:2.9.1
|
FROM ghcr.io/keitaroinc/ckan:2.9.1
|
||||||
|
|
||||||
LABEL maintainer="Keitaro Inc <info@keitaro.com>"
|
LABEL maintainer="Keitaro Inc <info@keitaro.com>"
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ services:
|
||||||
|
|
||||||
datapusher:
|
datapusher:
|
||||||
container_name: datapusher
|
container_name: datapusher
|
||||||
image: keitaro/ckan-datapusher:${DATAPUSHER_VERSION}
|
image: ghcr.io/keitaroinc/datapusher:${DATAPUSHER_VERSION}
|
||||||
networks:
|
networks:
|
||||||
- frontend
|
- frontend
|
||||||
- backend
|
- backend
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
###################
|
###################
|
||||||
### Extensions ####
|
### Extensions ####
|
||||||
###################
|
###################
|
||||||
FROM keitaro/ckan:2.8.6 as extbuild
|
FROM ghcr.io/keitaroinc/ckan:2.8.6 as extbuild
|
||||||
|
|
||||||
# Locations and tags, please use specific tags or revisions
|
# Locations and tags, please use specific tags or revisions
|
||||||
ENV S3FILESTORE_GIT_URL=https://github.com/keitaroinc/ckanext-s3filestore
|
ENV S3FILESTORE_GIT_URL=https://github.com/keitaroinc/ckanext-s3filestore
|
||||||
|
@ -20,7 +20,7 @@ USER ckan
|
||||||
############
|
############
|
||||||
### MAIN ###
|
### MAIN ###
|
||||||
############
|
############
|
||||||
FROM keitaro/ckan:2.8.6
|
FROM ghcr.io/keitaroinc/ckan:2.8.6
|
||||||
|
|
||||||
LABEL maintainer="Keitaro Inc <info@keitaro.com>"
|
LABEL maintainer="Keitaro Inc <info@keitaro.com>"
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ services:
|
||||||
|
|
||||||
datapusher:
|
datapusher:
|
||||||
container_name: datapusher
|
container_name: datapusher
|
||||||
image: keitaro/ckan-datapusher:${DATAPUSHER_VERSION}
|
image: ghcr.io/keitaroinc/datapusher:${DATAPUSHER_VERSION}
|
||||||
networks:
|
networks:
|
||||||
- frontend
|
- frontend
|
||||||
- backend
|
- backend
|
||||||
|
|
Loading…
Reference in New Issue