added step in workflow to automatic build psql-init image
This commit is contained in:
parent
16469a9fa6
commit
2c021de9f6
|
@ -246,3 +246,49 @@ jobs:
|
||||||
ghcr.io/keitaroinc/datapusher:${{ steps.datapusher.outputs.IMAGE_TAG }}
|
ghcr.io/keitaroinc/datapusher:${{ steps.datapusher.outputs.IMAGE_TAG }}
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache-datapusher
|
cache-from: type=local,src=/tmp/.buildx-cache-datapusher
|
||||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-datapusher
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-datapusher
|
||||||
|
|
||||||
|
build-psql-init:
|
||||||
|
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-psql-init
|
||||||
|
key: ${{ runner.os }}-buildx-psql-init-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-psql-init
|
||||||
|
|
||||||
|
- name: Get docker tag for psql-init image
|
||||||
|
id: psql-init
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.9/psql-init/Dockerfile)"
|
||||||
|
|
||||||
|
- name: Build and push psql-init
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./images/ckan/2.9/psql-init
|
||||||
|
file: ./images/ckan/2.9/psql-init/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
keitaro/psql-init:${{ steps.psql-init.outputs.IMAGE_TAG }}
|
||||||
|
ghcr.io/keitaroinc/datapusher:${{ steps.psql-init.outputs.IMAGE_TAG }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache-psql-init
|
||||||
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-psql-init
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
# Start with a lightweight base image
|
# Start with a lightweight base image
|
||||||
FROM python:3.9-alpine
|
FROM python:3.9-alpine
|
||||||
|
|
||||||
|
# Used by Github Actions to tag the image with
|
||||||
|
ENV IMAGE_TAG=0.0.1
|
||||||
|
|
||||||
# Set the working directory in the container
|
# Set the working directory in the container
|
||||||
WORKDIR /srv
|
WORKDIR /srv
|
||||||
|
|
||||||
|
@ -14,4 +17,3 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||||
# Copy the rest of the application code to the container
|
# Copy the rest of the application code to the container
|
||||||
COPY psql-init/ .
|
COPY psql-init/ .
|
||||||
|
|
||||||
CMD ["sleep", "1000"]
|
|
Loading…
Reference in New Issue