-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (27 loc) · 784 Bytes
/
Dockerfile
File metadata and controls
42 lines (27 loc) · 784 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
38
39
40
41
42
FROM node:20-alpine as builder
ENV WORK /opt/driver-instructions
RUN apk add --no-cache git openssh-client
# Create app directory
RUN mkdir -p ${WORK}
WORKDIR ${WORK}
# Install app dependencies
COPY package.json yarn.lock ${WORK}
RUN yarn
# Bundle app source
COPY . ${WORK}
ARG BUILD_ENV=prod
COPY .env.${BUILD_ENV} ${WORK}/.env.production
# Apikey for Digitransit maps
ARG DIGITRANSIT_APIKEY
ENV REACT_APP_DIGITRANSIT_APIKEY=${DIGITRANSIT_APIKEY}
RUN yarn build
# The actual image comes here
FROM node:18-alpine as server
ENV WORK /opt/driver-instructions
# Create app directory
RUN mkdir -p ${WORK}
WORKDIR ${WORK}
# Install serve
RUN yarn global add serve@^14.2.0
COPY --from=builder /opt/driver-instructions/build build/
CMD ["serve", "-s", "-l", "3000", "build/"]