File tree Expand file tree Collapse file tree 3 files changed +80
-23
lines changed Expand file tree Collapse file tree 3 files changed +80
-23
lines changed Original file line number Diff line number Diff line change 11ARG BUILD_DIR=/build
22
3- # Client Build Container
3+ # Build Container
44FROM --platform=$BUILDPLATFORM python:3.11-slim-bullseye AS build
55
66ARG BUILD_DIR
@@ -16,45 +16,36 @@ RUN npm ci
1616COPY client ./client
1717RUN npm run build
1818
19- # Pipenv Build Container
20- FROM python:3.11-alpine3.19 as pipenv-build
21-
22- ARG BUILD_DIR
23-
24- ENV APP_PATH=/app
25-
26- RUN apk add --no-cache build-base rust cargo libffi libffi-dev libssl3 openssl-dev
27-
28- RUN pip install --no-cache-dir pipenv
29-
30- WORKDIR ${APP_PATH}
31-
32- COPY LICENSE Pipfile Pipfile.lock ./
33- RUN mkdir .venv
34- RUN pipenv install --deploy --ignore-pipfile && \
35- pipenv --clear
36-
3719# Runtime Container
38- FROM python:3.11-alpine3.19
20+ FROM python:3.11-slim-bullseye
3921
4022ARG BUILD_DIR
4123
4224ENV PUID=1000
4325ENV PGID=1000
26+ ENV EXEC_TOOL=gosu
4427
4528ENV APP_PATH=/app
4629ENV FLATNOTES_PATH=/data
4730
4831RUN mkdir -p ${APP_PATH}
4932RUN mkdir -p ${FLATNOTES_PATH}
5033
51- RUN apk add --no-cache su-exec libssl3 libgcc curl
34+ RUN apt update && apt install -y \
35+ curl \
36+ gosu \
37+ && rm -rf /var/lib/apt/lists/*
38+
39+ RUN pip install --no-cache-dir pipenv
5240
5341WORKDIR ${APP_PATH}
5442
43+ COPY LICENSE Pipfile Pipfile.lock ./
44+ RUN pipenv install --deploy --ignore-pipfile --system && \
45+ pipenv --clear
46+
5547COPY server ./server
5648COPY --from=build ${BUILD_DIR}/client/dist ./client/dist
57- COPY --from=pipenv-build ${APP_PATH}/.venv/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
5849
5950VOLUME /data
6051EXPOSE 8080/tcp
Original file line number Diff line number Diff line change 1+ ARG BUILD_DIR=/build
2+
3+ # Client Build Container
4+ FROM --platform=$BUILDPLATFORM python:3.11-slim-bullseye AS build
5+
6+ ARG BUILD_DIR
7+
8+ RUN mkdir ${BUILD_DIR}
9+ WORKDIR ${BUILD_DIR}
10+
11+ RUN apt update && apt install -y npm
12+
13+ COPY package.json package-lock.json .htmlnanorc ./
14+ RUN npm ci
15+
16+ COPY client ./client
17+ RUN npm run build
18+
19+ # Pipenv Build Container
20+ FROM python:3.11-alpine3.19 as pipenv-build
21+
22+ ARG BUILD_DIR
23+
24+ ENV APP_PATH=/app
25+
26+ RUN apk add --no-cache build-base rust cargo libffi libffi-dev libssl3 openssl-dev
27+
28+ RUN pip install --no-cache-dir pipenv
29+
30+ WORKDIR ${APP_PATH}
31+
32+ COPY LICENSE Pipfile Pipfile.lock ./
33+ RUN mkdir .venv
34+ RUN pipenv install --deploy --ignore-pipfile && \
35+ pipenv --clear
36+
37+ # Runtime Container
38+ FROM python:3.11-alpine3.19
39+
40+ ARG BUILD_DIR
41+
42+ ENV PUID=1000
43+ ENV PGID=1000
44+ ENV EXEC_TOOL=su-exec
45+
46+ ENV APP_PATH=/app
47+ ENV FLATNOTES_PATH=/data
48+
49+ RUN mkdir -p ${APP_PATH}
50+ RUN mkdir -p ${FLATNOTES_PATH}
51+
52+ RUN apk add --no-cache su-exec libssl3 libgcc curl
53+
54+ WORKDIR ${APP_PATH}
55+
56+ COPY server ./server
57+ COPY --from=build ${BUILD_DIR}/client/dist ./client/dist
58+ COPY --from=pipenv-build ${APP_PATH}/.venv/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
59+
60+ VOLUME /data
61+ EXPOSE 8080/tcp
62+ HEALTHCHECK --interval=60s --timeout=10s CMD curl -f http://localhost:8080/health || exit 1
63+
64+ COPY entrypoint.sh /
65+ RUN chmod +x /entrypoint.sh
66+ ENTRYPOINT [ "/entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then
3131 chown -R ${PUID} :${PGID} ${FLATNOTES_PATH}
3232
3333 echo Starting flatnotes as user ${PUID} ...
34- exec su-exec ${PUID} :${PGID} ${flatnotes_command}
34+ exec ${EXEC_TOOL} ${PUID} :${PGID} ${flatnotes_command}
3535
3636else
3737 echo " A user was set by docker, skipping file permission changes."
You can’t perform that action at this time.
0 commit comments