-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 764 Bytes
/
Dockerfile
File metadata and controls
37 lines (27 loc) · 764 Bytes
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
FROM node:20-slim AS build
WORKDIR /app
COPY package*.json ./
RUN --mount=type=cache,target=/root/.npm npm ci
COPY . .
RUN node ace build
FROM node:20-slim AS production
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN addgroup --system --gid 1001 app \
&& adduser --system --uid 1001 --ingroup app app
ENV NODE_ENV=production
ENV PORT=3333
ENV HOST=0.0.0.0
COPY package*.json ./
RUN --mount=type=cache,target=/root/.npm npm ci --omit=dev
COPY --from=build /app/build ./build
COPY start.sh ./start.sh
RUN mkdir -p /app/tmp \
&& sed -i 's/\r$//' ./start.sh \
&& chmod +x ./start.sh \
&& chown -R app:app /app
USER app
EXPOSE 3333
CMD ["sh", "./start.sh"]