-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
60 lines (44 loc) · 1.83 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
58
59
60
FROM node:18.15-bullseye as hashtopolis-web-ui-base
ENV PUPPETEER_SKIP_DOWNLOAD='true'
EXPOSE 4200
# Enable possible build args for injecting user commands
ARG CONTAINER_USER_CMD_PRE
ARG CONTAINER_USER_CMD_POST
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV NODE_OPTIONS='--use-openssl-ca'
# Add support for TLS inspection corporate setups, see .env.sample for details
ENV NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt
# Check for and run optional user-supplied command to enable (advanced) customizations of the container
RUN if [ -n "${CONTAINER_USER_CMD_PRE}" ]; then echo "Applying CONTAINER_USER_CMD_PRE customizations..."; echo "${CONTAINER_USER_CMD_PRE}" | sh ; fi
RUN mkdir /app
WORKDIR /app
# Docker entry location
COPY docker-entrypoint.sh /usr/local/bin
# BUILD Image
#----BEGIN----
FROM hashtopolis-web-ui-base as hashtopolis-web-ui-build
# Coping the app into the container
COPY . ./
# npm package - clean install
COPY package-lock.json package.json ./
RUN npm ci
RUN npm run build
# ----END----
# DEVELOPMENT Image
# ----BEGIN----
FROM hashtopolis-web-ui-base as hashtopolis-web-ui-dev
# Enable tooling like 'ng' for regular users
RUN echo "export PATH=/app/node_modules/.bin:${PATH}" >> /etc/profile.d/npm.inc.sh
# Install required tooling envsubst
RUN apt-get update && apt-get -y install --no-install-recommends gettext-base 2>&1
USER node
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/docker-entrypoint.sh", "development" ]
# ----END----
# PRODUCTION Image
# ----BEGIN----
FROM nginx:bullseye as hashtopolis-web-ui-prod
COPY --from=hashtopolis-web-ui-build /app/dist/ /usr/share/nginx/html
COPY --from=hashtopolis-web-ui-build /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/docker-entrypoint.sh", "production" ]
# ----END----