Skip to content

Commit

Permalink
Upgrade to S6 Overlay 3.x and add Ubuntu 22.04 support (#7)
Browse files Browse the repository at this point in the history
* Upgrade to latest version of S6 Overlay & more (#6)

* Added credit

* Added S6 Overlay 3.x

* Added multi-arch builds

* Added docker buildkit

* Added docker buildx

* Use QEMU emulator

* Add multi-arch support

* Added 22.04

* Added platforms

* Added platforms to production image

* Require valid certificate in download

* Added CA certificates

* Ensure certificates are checked

* Added Act support

* Added beta workflow

* Fixed secrets

* Removed whitespace

* Added github sha

* Remove reference

* Specified branch

* Fixed reference

* Added base OS support

* Updated all workflows to new structure

* Added execution permissions

* Removed execution layer

* Bumped S6 Overlay to 3.1.1.0

* Removed syslogd

* Keep ENV for S6

* Defaulted to 22.04

* Updated contributing build notes

* Upgraded S6 overlay to v3.1.2.1

* Adjusted tag name

* Added build stage

* Renamed repo

* Fixed trigger

* Cleaned up comments

* Changed variable name
  • Loading branch information
jaydrogers authored Oct 25, 2022
1 parent c9fa04a commit 51ae689
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 178 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GITHUB_TOKEN=
DOCKER_HUB_ACCESS_TOKEN=
DOCKER_HUB_README_PASSWORD=
DOCKER_HUB_README_USERNAME=
DOCKER_HUB_USERNAME=
44 changes: 0 additions & 44 deletions .github/workflows/docker-publish-beta.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/docker-publish-pr.yml

This file was deleted.

63 changes: 0 additions & 63 deletions .github/workflows/docker-publish-production.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/event-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Docker Publish (Edge - Pull Request)

on:
pull_request:
branches:
- '!dev'

env:
PR_NUMBER: ${{ github.event.pull_request.number }}

jobs:
build:
uses: ./.github/workflows/workflow-docker-publish.yml
with:
tag-prefix: 'edge-${{ env.PR_NUMBER }}-'
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/event-release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Publish (Beta Images)

on:
# When changes are pushed to the "dev" branch, run it
push:
branches:
- dev

# Run every week at 0800 UTC to update the images
schedule:
- cron: '0 8 * * 6'

jobs:
build:
uses: ./.github/workflows/workflow-docker-publish.yml
with:
tag-prefix: 'beta-'
secrets: inherit
38 changes: 38 additions & 0 deletions .github/workflows/event-release-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Publish (Production Images)

on:
# When changes are pushed to the "main" branch, run it
push:
branches:
- main

# Run every week at 0800 UTC to update the images
schedule:
- cron: '0 8 * * 0'

jobs:
build:
uses: ./.github/workflows/workflow-docker-publish.yml
with:
tag-prefix: ''
secrets: inherit

update_container_readme:
runs-on: ubuntu-latest
name: Push README to Docker Hub
steps:
- name: git checkout
uses: actions/checkout@v2
with:
ref: main

- name: push README to Dockerhub
uses: christian-korneck/update-container-description-action@v1
env:
DOCKER_USER: ${{ secrets.DOCKER_HUB_README_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKER_HUB_README_PASSWORD }}
with:
destination_container_repo: serversideup/s6-overlay
provider: dockerhub
short_description: 'Base image for projects that need S6 Overlay'
readme_file: 'README.md'
59 changes: 59 additions & 0 deletions .github/workflows/workflow-docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
workflow_call:
inputs:
tag-prefix:
required: true
type: string
default: 'beta-'

jobs:
docker-publish:
runs-on: ubuntu-20.04
# Configure our deployment strategy. Order is important here and we want it to go: CLI < FPM < FPM-NGINX
strategy:
# We want to limit the number of jobs to the number of versions that we're offering (since we want the dependency order to be built correctly)
max-parallel: 2
# Set our base image and versions here
matrix:
linux-flavor:
- ubuntu
version:
- "20.04"
- "22.04"
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]

- uses: actions/checkout@v2
with:
ref: ${{ steps.branch-name.outputs.current_branch }}

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: |
linux/amd64
linux/arm/v7
linux/arm64/v8
linux/ppc64le
linux/riscv64
linux/s390x
build-args: |
BASE_OS_IMAGE=${{ matrix.linux-flavor }}:${{ matrix.version }}
pull: true
push: true
tags: "serversideup/s6-overlay:${{ inputs.tag-prefix}}${{ matrix.linux-flavor }}-${{ matrix.version }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
16 changes: 5 additions & 11 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@ As stated in the README, there are a lot of dependencies on these images, so ple
We'd love to have your help, but it might be best to explain your intentions first before contributing.

# Running things locally
Run this command to build the local image on your machine:
Run this command to build both variations on your machine:
```sh
docker build -t localhost/docker-baseimage-s6-overlay-ubuntu .
docker build --build-arg BASE_OS_IMAGE="ubuntu:20.04" -t serversideup/s6-overlay:beta-ubuntu-20.04 .
docker build --build-arg BASE_OS_IMAGE="ubuntu:22.04" -t serversideup/s6-overlay:beta-ubuntu-22.04 .
```
The above command will build an image called `localhost/docker-baseimage-s6-overlay-ubuntu`.

#### Inspect images
#### Inspect & testing images
This is helpful for inspecting images:
```sh
docker run --rm -it localhost/docker-baseimage-s6-overlay-ubuntu bash
```

#### Running a test web server:
This is helpful for testing things out:
```sh
docker run --rm localhost/docker-baseimage-s6-overlay-ubuntu
docker run --rm -it serversideup/s6-overlay:beta-ubuntu-22.04 bash
```
57 changes: 43 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
FROM ubuntu:20.04
LABEL maintainer="@jaydrogers"
ARG BASE_IMAGE=ubuntu:22.04

# build image
FROM ${BASE_IMAGE} as build

ARG S6_DIR=/opt/s6/
ARG S6_SRC_DEP="xz-utils wget"
ARG S6_SRC_URL="https://github.com/just-containers/s6-overlay/releases/download"
ARG S6_VERSION="v3.1.2.1"

# set version for s6 overlay
ARG OVERLAY_VERSION="v2.2.0.3"
ARG OVERLAY_ARCH="amd64"
ENV DEBIAN_FRONTEND="noninteractive" \
S6_KEEP_ENV=1

# install S6 Overlay
RUN mkdir -p $S6_DIR; \
apt-get update; \
apt-get install -yq $S6_SRC_DEP --no-install-recommends --no-install-suggests; \
export SYS_ARCH=$(uname -m); \
case "$SYS_ARCH" in \
aarch64 ) export S6_ARCH='aarch64' ;; \
arm64 ) export S6_ARCH='aarch64' ;; \
armhf ) export S6_ARCH='armhf' ;; \
arm* ) export S6_ARCH='arm' ;; \
i4* ) export S6_ARCH='i486' ;; \
i6* ) export S6_ARCH='i686' ;; \
riscv64 ) export S6_ARCH='riscv64' ;; \
s390* ) export S6_ARCH='s390x' ;; \
* ) export S6_ARCH='x86_64' ;; \
esac; \
untar (){ \
echo "⏬ Downloading $1"; \
wget --no-check-certificate -O- $1 | tar Jxp -C $S6_DIR; \
}; \
\
echo "⬇️ Downloading s6 overlay:${S6_ARCH}-${S6_VERSION} for ${SYS_ARCH}" \
&& untar ${S6_SRC_URL}/${S6_VERSION}/s6-overlay-noarch.tar.xz \
&& untar ${S6_SRC_URL}/${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.xz

# main image
FROM ${BASE_IMAGE}
LABEL maintainer="@jaydrogers"

# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
ENV DEBIAN_FRONTEND="noninteractive" \
S6_KEEP_ENV=1

# set environment variables
ARG DEBIAN_FRONTEND="noninteractive"
ENV HOME="/root" \
LANGUAGE="en_US.UTF-8" \
LANG="en_US.UTF-8" \
TERM="xterm"
COPY --from=build /opt/s6/ /

ENTRYPOINT ["/init"]
Loading

0 comments on commit 51ae689

Please sign in to comment.