From 4563148a61ba892e8f2bb66342f00a950bcd5315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Alibo=C5=BCek?= <70749001+galibozek@users.noreply.github.com> Date: Wed, 19 Jan 2022 22:55:17 +0100 Subject: [PATCH] Upgrade Alpine from 3.13 to 3.15 (#18050) * Upgrade alpine to 3.15 * Add executability test to entrypoint for too old dockers Signed-off-by: Andrew Thornton * Update docker/rootless/usr/local/bin/docker-entrypoint.sh Co-authored-by: zeripath --- Dockerfile | 8 +++----- Dockerfile.rootless | 8 +++----- docker/root/usr/bin/entrypoint | 6 ++++++ docker/rootless/usr/local/bin/docker-entrypoint.sh | 6 ++++++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index e9767402c74..8cb88ae83e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ - -################################### -#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image -FROM techknowlogick/go:1.17-alpine3.13 AS build-env +#Build stage +FROM golang:1.17-alpine3.15 AS build-env ARG GOPROXY ENV GOPROXY ${GOPROXY:-direct} @@ -25,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \ # Begin env-to-ini build RUN go build contrib/environment-to-ini/environment-to-ini.go -FROM alpine:3.13 +FROM alpine:3.15 LABEL maintainer="maintainers@gitea.io" EXPOSE 22 3000 diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 5b22b26bc22..78a6c3cb038 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -1,7 +1,5 @@ - -################################### -#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image -FROM techknowlogick/go:1.17-alpine3.13 AS build-env +#Build stage +FROM golang:1.17-alpine3.15 AS build-env ARG GOPROXY ENV GOPROXY ${GOPROXY:-direct} @@ -25,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \ # Begin env-to-ini build RUN go build contrib/environment-to-ini/environment-to-ini.go -FROM alpine:3.13 +FROM alpine:3.15 LABEL maintainer="maintainers@gitea.io" EXPOSE 2222 3000 diff --git a/docker/root/usr/bin/entrypoint b/docker/root/usr/bin/entrypoint index a3c03ecff37..0acfec4dbe4 100755 --- a/docker/root/usr/bin/entrypoint +++ b/docker/root/usr/bin/entrypoint @@ -1,5 +1,11 @@ #!/bin/sh +# Protect against buggy runc in docker <20.10.6 causing problems in with Alpine >= 3.14 +if [ ! -x /bin/sh ]; then + echo "Executable test for /bin/sh failed. Your Docker version is too old to run Alpine 3.14+ and Gitea. You must upgrade Docker."; + exit 1; +fi + if [ "${USER}" != "git" ]; then # rename user sed -i -e "s/^git\:/${USER}\:/g" /etc/passwd diff --git a/docker/rootless/usr/local/bin/docker-entrypoint.sh b/docker/rootless/usr/local/bin/docker-entrypoint.sh index d05777adc56..ca509214bff 100755 --- a/docker/rootless/usr/local/bin/docker-entrypoint.sh +++ b/docker/rootless/usr/local/bin/docker-entrypoint.sh @@ -1,5 +1,11 @@ #!/bin/sh +# Protect against buggy runc in docker <20.10.6 causing problems in with Alpine >= 3.14 +if [ ! -x /bin/sh ]; then + echo "Executable test for /bin/sh failed. Your Docker version is too old to run Alpine 3.14+ and Gitea. You must upgrade Docker."; + exit 1; +fi + if [ -x /usr/local/bin/docker-setup.sh ]; then /usr/local/bin/docker-setup.sh || { echo 'docker setup failed' ; exit 1; } fi