-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
31 lines (26 loc) · 890 Bytes
/
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
# THIS SPECIFIC FILE IS DISTRIBUTED UNDER THE UNLICENSE: http://unlicense.org.
#
# YOU CAN FREELY USE THIS CODE EXAMPLE TO KICKSTART A PROJECT OF YOUR OWN.
# FEEL FREE TO REPLACE OR REMOVE THIS HEADER.
FROM node:13.10.1-alpine as base
RUN apk update
RUN yarn global add http-server
# IF UID or GUID is already taken
RUN apk --no-cache add shadow && \
usermod -u 2000 node && \
groupmod -g 2000 node
RUN find / -group 1000 -exec chgrp -h 2000 {} \;
RUN find / -user 1000 -exec chown -h 2000 {} \;
FROM scratch as user
COPY --from=base . .
ARG HOST_UID=${HOST_UID:-4000}
ARG HOST_USER=${HOST_USER:-nodummy}
RUN [ "${HOST_USER}" == "root" ] || \
(adduser -h /home/${HOST_USER} -D -u ${HOST_UID} ${HOST_USER} \
&& chown -R "${HOST_UID}:${HOST_UID}" /home/${HOST_USER})
USER ${HOST_USER}
WORKDIR /home/${HOST_USER}
COPY package*.json ./
RUN yarn
COPY . .
RUN yarn run build