forked from FNNDSC/ChRIS_ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·57 lines (44 loc) · 1.16 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
#
# Docker file for ChRIS ui production server
#
# Build with
#
# docker build -t <name> .
#
# For example if building a local version, you could do:
#
# docker build -t local/chris_ui .
#
# In the case of a proxy (located at say 10.41.13.4:3128), do:
#
# export PROXY="http://10.41.13.4:3128"
# docker build --build-arg http_proxy=${PROXY} --build-arg UID=$UID -t local/chris_ui .
#
# To run the server up, do:
#
# docker run --name chris_ui -p 3000:3000 -d local/chris_ui
#
# To run an interactive shell inside this container, do:
#
# docker exec -it chris_ui sh
#
FROM node:14 as builder
WORKDIR /app/
COPY . .
# Build the app for production
RUN npm install && npm run build
FROM node:14-alpine
# Pass a UID on build command line (see above) to set internal UID
ARG UID=1001
ENV UID=$UID VERSION="0.1"
# Install server
RUN yarn global add serve --network-timeout 100000
RUN adduser --uid $UID --disabled-password localuser \
&& su - localuser -c "mkdir app"
WORKDIR /home/localuser/app/
COPY --from=builder --chown=localuser /app/build .
# Start as user localuser
USER localuser
EXPOSE 3000
# Serve the production build
CMD serve --single -l 3000 .