-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Dockerfile.dev
78 lines (56 loc) · 1.94 KB
/
Dockerfile.dev
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
74
75
76
77
78
# This Dockerfile is used for producing 3 container images.
#
# base - which is thrown away, that contains node and the basic infrastructure.
# devcontainer - which is used for development, and contains the source code and the node_modules.
# dist - which is used for production, and contains the built source code and the node_modules.
ARG NODE_VERSION="20.17"
# Base image
FROM docker.io/node:${NODE_VERSION}-alpine3.19 AS base
## Just reduce unccessary noise in the logs.
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
ENV NEXT_TELEMETRY_DISABLED=1
RUN apk add --no-cache \
caddy \
bash=5.2.21-r0 \
supervisor=4.2.5-r4
WORKDIR /app
EXPOSE 3000
EXPOSE 4200
EXPOSE 5000
COPY var/docker/entrypoint.sh /app/entrypoint.sh
COPY var/docker/supervisord.conf /etc/supervisord.conf
COPY var/docker/supervisord /app/supervisord_available_configs/
COPY var/docker/Caddyfile /app/Caddyfile
COPY .env.example /config/postiz.env
VOLUME /config
VOLUME /uploads
LABEL org.opencontainers.image.source=https://github.com/gitroomhq/postiz-app
ENTRYPOINT ["/app/entrypoint.sh"]
# Builder image
FROM base AS devcontainer
RUN apk add --no-cache \
pkgconfig \
gcc \
pixman-dev \
cairo-dev \
pango-dev \
make \
build-base
COPY nx.json tsconfig.base.json package.json package-lock.json build.plugins.js /app/
COPY apps /app/apps/
COPY libraries /app/libraries/
RUN npm ci --no-fund && npx nx run-many --target=build --projects=frontend,backend,workers,cron
VOLUME /config
VOLUME /uploads
LABEL org.opencontainers.image.title="Postiz App (DevContainer)"
# Output image
FROM base AS dist
COPY --from=devcontainer /app/node_modules/ /app/node_modules/
COPY --from=devcontainer /app/dist/ /app/dist/
# Required for prisma
COPY --from=devcontainer /app/libraries/ /app/libraries/
COPY package.json nx.json /app/
VOLUME /config
VOLUME /uploads
## Labels at the bottom, because CI will eventually add dates, commit hashes, etc.
LABEL org.opencontainers.image.title="Postiz App (Production)"