- Use the python:3.11-alpine3.19 image as runtime container base
- Replace gosu with su-exec
- Clean pip and pipenv package cache
RUN npm run build
# Runtime Container
-FROM python:3.11-slim-bullseye
+FROM python:3.11-alpine3.19
ARG BUILD_DIR
RUN mkdir -p ${APP_PATH}
RUN mkdir -p ${FLATNOTES_PATH}
-RUN apt update && apt install -y \
- curl \
- gosu \
- && rm -rf /var/lib/apt/lists/*
+RUN apk add --no-cache su-exec curl
-RUN pip install pipenv
+RUN pip install --no-cache-dir pipenv
WORKDIR ${APP_PATH}
COPY LICENSE Pipfile Pipfile.lock ./
-RUN pipenv install --deploy --ignore-pipfile --system
+RUN pipenv install --deploy --ignore-pipfile --system && \
+ pipenv --clear
COPY server ./server
COPY --from=build ${BUILD_DIR}/client/dist ./client/dist
-#!/bin/bash
+#!/bin/sh
set -e
chown -R ${PUID}:${PGID} ${FLATNOTES_PATH}
echo Starting flatnotes as user ${PUID}...
- exec gosu ${PUID}:${PGID} ${flatnotes_command}
+ exec su-exec ${PUID}:${PGID} ${flatnotes_command}
else
echo "A user was set by docker, skipping file permission changes."