-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup automated docker image build + push
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
|
||
jobs: | ||
login: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Figure out docker image tag | ||
id: taggen | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: | | ||
quay.io/yuvipanda/z2jh-hub-with-fancy-profiles | ||
tags: | | ||
type=sha | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Quay.io | ||
uses: docker/login-action@v1 | ||
# Run this only on merge | ||
if: "${{ github.event_name == 'push' }}" | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: "${{ github.event_name == 'push' }}" | ||
tags: ${{ steps.taggen.outputs.tags }} | ||
|
||
- name: Image Tag | ||
run: echo ${{ steps.taggen.outputs.tags }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ARG Z2JH_VERSION=3.2.1 | ||
|
||
# We need node to build the package, but not to run it | ||
# Use the same base image but with nodejs installed as the builder, | ||
# then copy over just the built wheel files for the final image. | ||
# This keeps image size low while also making the whole process | ||
# reasonably simple | ||
FROM quay.io/jupyterhub/k8s-hub:${Z2JH_VERSION} as builder | ||
|
||
USER root | ||
|
||
RUN apt update > /dev/null && \ | ||
apt install --yes nodejs npm >/dev/null | ||
|
||
ADD . /srv/repo | ||
RUN pip install build | ||
RUN python -m build /srv/repo --outdir /srv/wheels/ | ||
|
||
FROM quay.io/jupyterhub/k8s-hub:${Z2JH_VERSION} | ||
|
||
USER root | ||
COPY --from=builder /srv/wheels/*.whl /srv/wheels/ | ||
RUN pip install /srv/wheels/* | ||
|
||
USER ${NB_USER} |