From c4fdca1a2f3e70ff1d6c8d7019b5af5a1055cc20 Mon Sep 17 00:00:00 2001 From: David Losada Carballo Date: Mon, 8 Jul 2024 15:00:53 +0200 Subject: [PATCH] debian and other updates --- .github/workflows/ship.yml | 12 ++--- debian.Dockerfile | 50 ++++++++++++++++---- entrypoint.dockerize.sh => init.dockerize.sh | 0 services.d/cron/run | 3 ++ 4 files changed, 50 insertions(+), 15 deletions(-) rename entrypoint.dockerize.sh => init.dockerize.sh (100%) create mode 100644 services.d/cron/run diff --git a/.github/workflows/ship.yml b/.github/workflows/ship.yml index 31c8432..a25925d 100644 --- a/.github/workflows/ship.yml +++ b/.github/workflows/ship.yml @@ -9,28 +9,28 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 with: install: true - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push (debian) id: docker_build_debian - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . file: ./debian.Dockerfile platforms: linux/amd64 push: ${{ github.event_name != 'pull_request' }} - tags: ushahidi/debian:buster-dockerize + tags: ushahidi/debian:bullseye-dockerize - name: Build and push (alpine) id: docker_build_alpine @@ -40,4 +40,4 @@ jobs: file: ./alpine.Dockerfile platforms: linux/amd64 push: ${{ github.event_name != 'pull_request' }} - tags: ushahidi/debian:3.12-dockerize + tags: ushahidi/alpine:3.12-dockerize diff --git a/debian.Dockerfile b/debian.Dockerfile index 3d96086..44ba456 100644 --- a/debian.Dockerfile +++ b/debian.Dockerfile @@ -1,16 +1,41 @@ -FROM debian:buster +FROM debian:bullseye -ENV DOCKERIZE_VERSION=v0.6.1 \ - DOCKERIZE_TEMPLATE_DIR=/tmpl +ARG TARGETPLATFORM +ARG TARGETARCH + +LABEL platform="$TARGETPLATFORM" +LABEL arch="$TARGETARCH" + +ENV DOCKERIZE_VERSION=v0.7.0 \ + DOCKERIZE_TEMPLATE_DIR=/tmpl \ + S6_OVERLAY_VERSION=v3.2.0.0 RUN apt-get update && \ - apt-get install -y curl findutils && \ - curl -L https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz | \ - tar -C /usr/local/bin -xzv && \ + apt-get install -y cron xz-utils curl findutils && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN case "${TARGETPLATFORM}" in \ + "linux/amd64") S6_ARCH=x86_64 ;; \ + "linux/arm64") S6_ARCH=aarch64 ;; \ + "linux/arm/v7") S6_ARCH=armhf ;; \ + "linux/arm/v6") S6_ARCH=arm ;; \ + "linux/386") S6_ARCH=i686 ;; \ + esac && \ + curl -L https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz | \ + tar -C / -xJv && \ + case "${TARGETPLATFORM}" in \ + "linux/amd64") DOCKERIZE_ARCH=amd64 ;; \ + "linux/arm64") DOCKERIZE_ARCH=armhf ;; \ + "linux/arm/v7") DOCKERIZE_ARCH=armhf ;; \ + "linux/arm/v6") DOCKERIZE_ARCH=armel ;; \ + "linux/386") DOCKERIZE_ARCH=386 ;; \ + esac && \ + curl -L https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-${DOCKERIZE_ARCH}-${DOCKERIZE_VERSION}.tar.gz | \ + tar -C /usr/local/bin -xzv + # Add utilities for Cascading Entrypoint Scripts +# To be deprecated: substituted by s6-overlay ENV DOCKERCES_MANAGE_UTIL=/manage.CES.sh \ DOCKERCES_ENTRYPOINT_CHAIN=/entrypoints.CES \ DOCKERCES_ENDPOINT_FILE=/endpoint.CES \ @@ -21,6 +46,13 @@ RUN ln -s /entrypoint.CES.sh $DOCKERCES_MANAGE_UTIL # Set up Cacading Entrypoint Scripts as master entrypoint ENTRYPOINT [ "/bin/bash", "/entrypoint.CES.sh" ] -# Add dockerize entrypoint -COPY /entrypoint.dockerize.sh / -RUN $DOCKERCES_MANAGE_UTIL add /entrypoint.dockerize.sh +# Add dockerize initializer +COPY /init.dockerize.sh / +RUN $DOCKERCES_MANAGE_UTIL add /init.dockerize.sh + +# TODO to introduce s6 overlay +# Add services +# ADD services.d/ /etc/services.d/ + +# Set s6-overlay as the CES endpoint +# RUN $DOCKERCES_MANAGE_UTIL endpoint /init diff --git a/entrypoint.dockerize.sh b/init.dockerize.sh similarity index 100% rename from entrypoint.dockerize.sh rename to init.dockerize.sh diff --git a/services.d/cron/run b/services.d/cron/run new file mode 100644 index 0000000..ab29ebb --- /dev/null +++ b/services.d/cron/run @@ -0,0 +1,3 @@ +#!/usr/bin/execlineb -P + +cron -f