forked from getwud/wud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (47 loc) · 1.35 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
# Common Stage
FROM node:18-alpine as base
LABEL maintainer="fmartinou"
EXPOSE 3000
ARG WUD_VERSION=unknown
ENV WORKDIR=/home/node/app
ENV WUD_LOG_FORMAT=text
ENV WUD_VERSION=$WUD_VERSION
WORKDIR /home/node/app
RUN mkdir /store
RUN apk update \
# add tzdata and openssl dependencies
&& apk add --no-cache tzdata openssl \
# add common programs used in shell scripting
&& apk add bash curl jq \
&& rm -rf /var/cache/apk/*
# Dependencies Stage (Backend)
FROM base as dependencies
# Copy backend package files
COPY app/package*.json ./
# Install backend dependencies
RUN npm ci --omit=dev --omit=optional --no-audit --no-fund --no-update-notifier
# Frontend Build Stage
FROM base as ui-builder
# Set working directory to UI folder
WORKDIR /home/node/ui
# Copy UI package files
COPY ui/package*.json ./
# Install UI dependencies
RUN npm install
# Copy all UI source files
COPY ui/ ./
# Build the UI
RUN npm run build
# Release Stage
FROM base as release
# Default entrypoint
COPY Docker.entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
CMD ["node", "index"]
# Copy backend dependencies
COPY --from=dependencies /home/node/app/node_modules ./node_modules
# Copy backend app files
COPY app/ ./
# Copy built UI from the ui-builder stage
COPY --from=ui-builder /home/node/ui/dist ./ui