From 91e7bd8b68378e915ee6706c4b5e7ebfb73940fc Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 12 Oct 2022 14:31:07 +0200 Subject: [PATCH] Revert rebasing Docker image build on debian This reverts commits ad4a9d4dff6c6fbd2c1cd11555b5a679ab94605c, 34715d5f453457f63365aa5facc966ab42df03ac, 06caab9d561fb629a52301543f56475c1c054f81, 36932f601dbe1ea8338597f51adf719d1081cb78 and 8c36173027c596ec7db46789339157b9685c9226 The segfault issues still happen on arm64 in any case Signed-off-by: Thomas Citharel --- .gitlab-ci.yml | 7 +------ docker/production/Dockerfile | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cdb988c3..25507685 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -210,7 +210,6 @@ pages: - docker buildx create --use tls-environment # Install qemu/binfmt - docker pull tonistiigi/binfmt:latest - - docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-* - docker run --rm --privileged tonistiigi/binfmt:latest --install all # Login to DockerHub - mkdir -p ~/.docker @@ -238,14 +237,10 @@ build-docker-tag: - > docker buildx build --push - --platform $ARCH + --platform linux/amd64,linux/arm64,linux/arm -t framasoft/mobilizon:$CI_COMMIT_TAG -t framasoft/mobilizon:latest -f docker/production/Dockerfile . - parallel: - matrix: - - ARCH: ["linux/amd64", "linux/arm64", "linux/arm"] - allow_failure: true # Packaging app for amd64 package-app: diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 28c9bb06..7f19b640 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -1,7 +1,7 @@ # First build the application assets -FROM node:16 as assets +FROM node:16-alpine as assets -RUN apt update && apt dist-upgrade -y && apt install -y python3 build-essential bash imagemagick libncurses5 +RUN apk add --no-cache python3 build-base libwebp-tools bash imagemagick ncurses WORKDIR /build COPY js . @@ -10,9 +10,9 @@ RUN yarn install --network-timeout 100000 \ && yarn run build # Then, build the application binary -FROM elixir:1.14 AS builder +FROM elixir:1.14-alpine AS builder -RUN apt update && apt dist-upgrade -y && apt install -y build-essential git cmake +RUN apk add --no-cache build-base git cmake COPY mix.exs mix.lock ./ ENV MIX_ENV=prod @@ -32,7 +32,7 @@ RUN mix phx.digest.clean --all \ && mix release # Finally setup the app -FROM debian:bullseye-slim +FROM alpine ARG BUILD_DATE ARG VCS_REF @@ -47,22 +47,22 @@ LABEL org.opencontainers.image.title="mobilizon" \ org.opencontainers.image.revision=$VCS_REF \ org.opencontainers.image.created=$BUILD_DATE -RUN apt update && apt dist-upgrade -y && apt install -y curl openssl ca-certificates libncurses5 file postgresql-client gcc g++ imagemagick python3 python3-pip python3-pillow python3-cffi python3-brotli python3-dev libpango-1.0-0 libxslt-dev fonts-cantarell && rm -rf /var/lib/apt +RUN apk add --no-cache curl openssl ca-certificates ncurses-libs file postgresql-client libgcc libstdc++ imagemagick python3 py3-pip py3-pillow py3-cffi py3-brotli gcc g++ musl-dev python3-dev pango libxslt-dev ttf-cantarell RUN pip install weasyprint pyexcel-ods3 -RUN mkdir -p /var/lib/mobilizon/uploads && chown nobody:nogroup /var/lib/mobilizon/uploads -RUN mkdir -p /var/lib/mobilizon/uploads/exports/{csv,pdf,ods} && chown -R nobody:nogroup /var/lib/mobilizon/uploads/exports +RUN mkdir -p /var/lib/mobilizon/uploads && chown nobody:nobody /var/lib/mobilizon/uploads +RUN mkdir -p /var/lib/mobilizon/uploads/exports/{csv,pdf,ods} && chown -R nobody:nobody /var/lib/mobilizon/uploads/exports RUN mkdir -p /var/lib/mobilizon/timezones RUN curl -L 'https://packages.joinmobilizon.org/tz_world/timezones-geodata.dets' -o /var/lib/mobilizon/timezones/timezones-geodata.dets -RUN chown nobody:nogroup /var/lib/mobilizon/timezones -RUN mkdir -p /etc/mobilizon && chown nobody:nogroup /etc/mobilizon +RUN chown nobody:nobody /var/lib/mobilizon/timezones +RUN mkdir -p /etc/mobilizon && chown nobody:nobody /etc/mobilizon USER nobody EXPOSE 4000 ENV MOBILIZON_DOCKER=true -COPY --from=builder --chown=nobody:nogroup _build/prod/rel/mobilizon ./ +COPY --from=builder --chown=nobody:nobody _build/prod/rel/mobilizon ./ RUN cp /releases/*/runtime.exs /etc/mobilizon/config.exs COPY docker/production/docker-entrypoint.sh ./