Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker images #25

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Docker Build and Publish

on:
push:
# Publish semver tags as releases.
tags: [ 'v*' ] # Push events to matching v*, i.e. v1.0, v1.0.1

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# Base Image Version to use
BASE_IMAGE_VERSION: v2.2.0
# Tag Version which triggered the build
IMAGE_TAG: ${{ github.ref_name }}

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
cmd:
- arch: arm32v6
platforms: linux/arm/v6
- arch: arm64v8
platforms: linux/arm64/v8
- arch: amd64
platforms: linux/amd64

permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

#- name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Lower case repository name
run: |
echo "IMAGE_REPO=${REPO,,}" >>${GITHUB_ENV}
env:
REPO: '${{ github.repository }}'

- name: Build and push Docker images
id: build-and-push
run: |
docker buildx build . -f Dockerfile --platform ${{ matrix.cmd.platforms }} --push \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:${{ matrix.cmd.arch }}-${{ env.IMAGE_TAG }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:${{ matrix.cmd.arch }}-latest \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we assuming that v* tags are added in strongly increasing order? If not, -latest should only be pushed on main branch.

--build-arg FROM_IMAGE=certbot/certbot:${{ matrix.cmd.arch }}-${{ env.BASE_IMAGE_VERSION }}

- name: Sleep for 30 seconds
run: sleep 30s
shell: bash

- name: Link to latest tag
id: link-tag
run: |
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:latest \
--amend ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:amd64-latest \
--amend ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:arm32v6-latest \
--amend ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:arm64v8-latest
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:latest
Comment on lines +77 to +81
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we assuming that v* tags are added in strongly increasing order? If not, -latest should only be pushed on main branch.

7 changes: 3 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
environment: desec-test-account
strategy:
fail-fast: false
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
Expand All @@ -22,12 +23,10 @@ jobs:
'3.11',
]
certbot-version: [
# TODO at the time of writing, versions earlier than 1.14, including '0.40.0', the latest version for Ubuntu
# 20.04, are broken because ImportError: cannot import name 'IO' from 'acme.magic_typing'
# (venv/lib/python3.8/site-packages/acme/magic_typing.py)
'1.14.0',
'1.21.0',
'1.32.0',
'2.0.0',
'2.6.0',
]

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG FROM_IMAGE=certbot/certbot:amd64-v2.6.0

#Base
FROM ${FROM_IMAGE}

# Install the DNS plugin
COPY . /app
WORKDIR /app
RUN set -ex && \
pip install -r requirements.txt && \
pip install .

RUN rm -rf /app

#RUN pip install certbot-dns-desec