-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdashboard.Dockerfile
45 lines (32 loc) · 1016 Bytes
/
dashboard.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
FROM node:lts-alpine AS build
# Install packages
USER root
RUN apk add --no-cache git
# Create the directory!
RUN mkdir -p /tmp && chown -R node:node /tmp
WORKDIR /tmp
USER node
# Clone the repository to /tmp
RUN git clone https://github.com/TicketsBot/dashboard.git /tmp
# Switch directories to the frontend
WORKDIR /tmp/frontend
# Install node_modules (including development/build)
RUN npm install
# Build the frontend (and include the env variables required during buildtime)
ARG CLIENT_ID
ARG REDIRECT_URI
ARG API_URL
ARG WS_URL
RUN npm run build
# Remove development node_modules
RUN npm prune --production
# Production container
FROM node:lts-alpine AS prod
RUN mkdir -p /app && chown -R node:node /app
WORKDIR /app
USER node
COPY --from=build --chown=node:node /tmp/frontend/package*.json /app/
COPY --from=build --chown=node:node /tmp/frontend/node_modules /app/node_modules
COPY --from=build --chown=node:node /tmp/frontend/public /app/public
ENV NODE_ENV=production
CMD ["npm", "run", "start"]