Dockerfile fixes for arm64 and armv6/7 compatibility
authorCode-Otto <redacted>
Thu, 28 Mar 2024 00:30:06 +0000 (01:30 +0100)
committerCode-Otto <redacted>
Thu, 28 Mar 2024 00:30:06 +0000 (01:30 +0100)
- pipenv installation moved to a separate build stage
- Added build tools for pipenv to sucessfully compile from sources

Dockerfile

index e71b1023beb93d3e0fbdeeeb6bed14489a12e253..2d874decccb8290d995cf8394484d4142b742458 100644 (file)
@@ -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
git clone https://git.99rst.org/PROJECT