forked from etra0/ramos
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Dockerfile
35 lines (24 loc) · 811 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
32
33
34
35
FROM node:lts-buster-slim
ARG USER_UID="1001"
ARG USER_GID="1001"
EXPOSE 8080
# create and set working dir
RUN mkdir -p /var/www/html
WORKDIR /var/www/html
# copy all repo files
COPY . /var/www/html/
# install required packages
RUN npm update && npm install -g http-server
# add user and group, then change ownership to new user
RUN groupadd -g "$USER_UID" mallas \
&& useradd -m -d /home/mallas -s /bin/bash -u "$USER_UID" -g "$USER_GID" mallas \
&& chown -R "$USER_UID":"$USER_GID" /var/www/html
# drop privs to user
USER mallas
# install deps from package.json
RUN npm install
# minify code and then remove extra packages
RUN npm run build && npm run clean
RUN rm -rf scripts/
# start webserver on port 80
ENTRYPOINT ["/usr/local/bin/http-server", "--no-dotfiles", "--gzip", "-p", "8080"]