-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (47 loc) · 1.3 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1.3-labs
FROM node:23-bookworm-slim AS base
RUN <<EOF
apt-get update -qq &&
apt-get upgrade -qq &&
apt-get install -qq -y --no-install-recommends sqlite3 make
EOF
RUN npm i -g pnpm
# --- image for installing node dependencies ----- #
FROM base AS dependencies
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile
# --- image for building app --------------------- #
FROM base AS build
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN make
# --- final image -------------------------------- #
FROM base AS final
WORKDIR /app
LABEL maintainer="[email protected]"
ENV TERM=screen-256color
ENV LANG=C.UTF-8
ENV NODE_ENV=production
# ENV SHELL=/usr/bin/zsh
ARG USERNAME=marvin
ARG USER_UID=1001
ARG USER_GID=$USER_UID
# create non-root user
RUN <<EOF
groupadd --gid $USER_GID $USERNAME &&
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
EOF
RUN mkdir .next
COPY --from=build /app/public ./public
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
RUN chown -R $USERNAME:$USERNAME .next
USER $USERNAME
EXPOSE 3000
ENV NEXT_TELEMETRY_DISABLED=1
CMD HOSTNAME="0.0.0.0" node server.js
# CMD bash