From: Code-Otto Date: Thu, 28 Mar 2024 00:30:06 +0000 (+0100) Subject: Dockerfile fixes for arm64 and armv6/7 compatibility X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=0d3da85beda407c171fd2da1c58fe5c5b41c0c4d;p=flatnotes.git Dockerfile fixes for arm64 and armv6/7 compatibility - pipenv installation moved to a separate build stage - Added build tools for pipenv to sucessfully compile from sources --- diff --git a/Dockerfile b/Dockerfile index e71b102..2d874de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG BUILD_DIR=/build -# Build Container +# Client Build Container FROM --platform=$BUILDPLATFORM python:3.11-slim-bullseye AS build ARG BUILD_DIR @@ -16,6 +16,24 @@ RUN npm ci COPY client ./client RUN npm run build +# Pipenv Build Container +FROM python:3.11-alpine3.19 as pipenv-build + +ARG BUILD_DIR + +ENV APP_PATH=/app + +RUN apk add --no-cache build-base rust cargo libffi libffi-dev libssl3 openssl-dev + +RUN pip install --no-cache-dir pipenv + +WORKDIR ${APP_PATH} + +COPY LICENSE Pipfile Pipfile.lock ./ +RUN mkdir .venv +RUN pipenv install --deploy --ignore-pipfile && \ + pipenv --clear + # Runtime Container FROM python:3.11-alpine3.19 @@ -30,18 +48,13 @@ ENV FLATNOTES_PATH=/data RUN mkdir -p ${APP_PATH} RUN mkdir -p ${FLATNOTES_PATH} -RUN apk add --no-cache su-exec curl - -RUN pip install --no-cache-dir pipenv +RUN apk add --no-cache su-exec libssl3 libgcc curl WORKDIR ${APP_PATH} -COPY LICENSE Pipfile Pipfile.lock ./ -RUN pipenv install --deploy --ignore-pipfile --system && \ - pipenv --clear - COPY server ./server COPY --from=build ${BUILD_DIR}/client/dist ./client/dist +COPY --from=pipenv-build ${APP_PATH}/.venv/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/ VOLUME /data EXPOSE 8080/tcp