Merge pull request #1071 from manics/github-workflow-docker-push

GitHub workflow build and push to Docker hub
pull/1075/head
Simon Li 2021-08-21 20:05:38 +01:00 zatwierdzone przez GitHub
commit b3fb4cccaa
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 75 dodań i 14 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
name: Create a release on pypi.org
name: Publish
on:
push:
@ -32,3 +32,70 @@ jobs:
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
publish-docker:
runs-on: ubuntu-20.04
env:
DEFAULT_REGISTRY: quay.io
IMAGE_NAME: jupyterhub/repo2docker
services:
# So that we can test this in PRs/branches
local-registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Should we push this image to a public registry?
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then
REGISTRY=$DEFAULT_REGISTRY
else
REGISTRY=localhost:5000
fi
echo "REGISTRY=$REGISTRY" >> $GITHUB_ENV
echo "Publishing to $REGISTRY"
# versioneer requires the full git history for non-tags
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Setup docker to build for multiple platforms, see:
# https://github.com/docker/build-push-action/tree/v2.4.0#usage
# https://github.com/docker/build-push-action/blob/v2.4.0/docs/advanced/multi-platform.md
- name: Set up QEMU (for docker buildx)
uses: docker/setup-qemu-action@25f0500ff22e406f7191a2a8ba8cda16901ca018
- name: Set up Docker Buildx (for multi-arch builds)
uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609
with:
# Allows pushing to registry on localhost:5000
driver-opts: network=host
- name: Setup push rights to Docker Hub
if: env.REGISTRY != 'localhost:5000'
run: |
docker login -u "${{ secrets.DOCKER_REGISTRY_USERNAME }}" -p "${{ secrets.DOCKER_REGISTRY_TOKEN }}" "${{ env.REGISTRY }}"
# when building jupyter/repo2docker:master
# also push jupyter/repo2docker:1.2.3-3.abcd1234 (replace + with -)
- name: Get list of repo2docker docker tags
run: |
VERSION=$(python3 -c 'import versioneer; print(versioneer.get_version().replace("+", "-"))')
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$VERSION"
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main"
fi
echo "TAGS=$TAGS"
echo "TAGS=$TAGS" >> $GITHUB_ENV
- name: Build and push repo2docker
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ env.TAGS }}

Wyświetl plik

@ -5,8 +5,7 @@ RUN apk add --no-cache git python3 python3-dev py-pip build-base
# build wheels in first image
ADD . /tmp/src
# restore the hooks directory so that the repository isn't marked as dirty
RUN cd /tmp/src && git clean -xfd && git checkout -- hooks && git status
RUN cd /tmp/src && git clean -xfd && git status
RUN mkdir /tmp/wheelhouse \
&& cd /tmp/wheelhouse \
&& pip3 install wheel \

Wyświetl plik

@ -3,6 +3,7 @@
[![Build Status](https://github.com/jupyterhub/repo2docker/workflows/Continuous%20Integration/badge.svg)](https://github.com/jupyterhub/repo2docker/actions)
[![Documentation Status](https://readthedocs.org/projects/repo2docker/badge/?version=latest)](http://repo2docker.readthedocs.io/en/latest/?badge=latest)
[![Contribute](https://img.shields.io/badge/I_want_to_contribute!-grey?logo=jupyter)](https://repo2docker.readthedocs.io/en/latest/contributing/contributing.html)
[![Docker Repository on Quay](https://quay.io/repository/jupyterhub/repo2docker/status "Docker Repository on Quay")](https://quay.io/repository/jupyterhub/repo2docker)
`repo2docker` fetches a git repository and builds a container image based on
the configuration files found in the repository.
@ -95,3 +96,8 @@ files that ``repo2docker`` can use, see the
The philosophy of repo2docker is inspired by
[Heroku Build Packs](https://devcenter.heroku.com/articles/buildpacks).
## Docker Image
Repo2Docker can be run inside a Docker container if access to the Docker Daemon is provided, for example see [BinderHub](https://github.com/jupyterhub/binderhub). Docker images are [published to quay.io](https://quay.io/repository/jupyterhub/repo2docker). The old [Docker Hub image](https://hub.docker.com/r/jupyter/repo2docker) is no longer supported.

Wyświetl plik

@ -1,3 +0,0 @@
# Docker build hooks
These define our [custom hooks for docker automated builds](https://docs.docker.com/docker-hub/builds/advanced/#custom-build-phase-hooks)

Wyświetl plik

@ -1,8 +0,0 @@
#!/bin/bash
# when building jupyter/repo2docker:main
# also push jupyter/repo2docker:1.2.3-3.abcd1234 (replace + with -)
version=$(docker run $DOCKER_REPO:$DOCKER_TAG jupyter-repo2docker --version | sed s@+@-@)
VERSION_IMAGE="$DOCKER_REPO:$version"
docker tag $DOCKER_REPO:$DOCKER_TAG "$VERSION_IMAGE"
docker push "$VERSION_IMAGE"