-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile-dev
53 lines (39 loc) · 1.3 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
# @author DHENRY for mytinydc.com
# @license AGPL3
ARG RUNASUSER="utdon"
ARG RUNASUSERID="1001"
ARG RUNASGROUP="1001"
FROM node:20.10.0-alpine3.19 as base
# build
FROM base AS builder
WORKDIR /app
# Server
COPY ./src/ ./src/
RUN rm -f ./genSwaggerJson.ts
COPY ./openapi.yaml .
COPY ./package.json .
COPY ./locales ./locales
COPY ./tsconfig.json .
# Building server, final dest is /dist
RUN npm install && npm run build
RUN rm -rf node_modules && npm install --omit=dev
FROM base AS runner
LABEL org.opencontainers.image.source=https://github.com/dhenry123/utdon
LABEL org.opencontainers.image.description="Multi arch image"
LABEL org.opencontainers.image.licenses=AGPLV3
ARG RUNASUSER
ARG RUNASUSERID
ARG RUNASGROUP
# Creating user & group
RUN addgroup -S ${RUNASUSER} --gid "${RUNASGROUP}" && adduser -S ${RUNASUSER} -s /bin/sh --uid "${RUNASUSERID}" -G ${RUNASUSER}
USER ${RUNASUSERID}
WORKDIR /app
COPY --from=builder --chown=${RUNASUSERID}:${RUNASGROUP} /app/dist/ ./
COPY --from=builder --chown=${RUNASUSERID}:${RUNASGROUP} /app/openapi.yaml ./
COPY --from=builder --chown=${RUNASUSERID}:${RUNASGROUP} /app/node_modules/ ./node_modules
# UI must be built by developer
COPY --chown=${RUNASUSERID}:${RUNASGROUP} ./client/dist/ ./public
# data directory for mount point
RUN mkdir data
EXPOSE 3015
CMD ["node","main.js"]