ARG BUILD_DIR=/build
-# Build Container
+# Client Build Container
FROM --platform=$BUILDPLATFORM python:3.11-slim-bullseye AS build
ARG BUILD_DIR
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
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