-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Dockerfile.experimental
73 lines (49 loc) · 1.5 KB
/
Dockerfile.experimental
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
ARG BUILD_DIR=/build
# Client Build Container
FROM --platform=$BUILDPLATFORM node:20-alpine AS build
ARG BUILD_DIR
RUN mkdir ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
COPY .htmlnanorc \
package.json \
package-lock.json \
postcss.config.js \
tailwind.config.js \
vite.config.js \
./
RUN npm ci
COPY client ./client
RUN npm run build
# Pipenv Build Container
FROM python:3.11-alpine3.20 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.20
ARG BUILD_DIR
ENV PUID=1000
ENV PGID=1000
ENV EXEC_TOOL=su-exec
ENV FLATNOTES_PORT=8080
ENV APP_PATH=/app
ENV FLATNOTES_PATH=/data
RUN mkdir -p ${APP_PATH}
RUN mkdir -p ${FLATNOTES_PATH}
RUN apk add --no-cache su-exec libssl3 libgcc curl
WORKDIR ${APP_PATH}
COPY server ./server
COPY --from=build --chmod=777 ${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/
COPY entrypoint.sh healthcheck.sh /
RUN chmod +x /entrypoint.sh /healthcheck.sh
VOLUME /data
EXPOSE ${FLATNOTES_PORT}/tcp
HEALTHCHECK --interval=60s --timeout=10s CMD /healthcheck.sh
ENTRYPOINT [ "/entrypoint.sh" ]