forked from eclipse-tractusx/digital-product-pass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
78 lines (57 loc) · 2.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#################################################################################
# Catena-X - Product Passport Consumer Frontend
#
# Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the
# License for the specific language govern in permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################
# stage1 as builder
FROM node:lts-alpine as builder
WORKDIR /app
# Copy the package.json and install dependencies
COPY package*.json ./
RUN npm install -g npm
#RUN npm install
RUN npm install --legacy-peer-deps
# Copy rest of the files
COPY . .
# Build the project
RUN npm run build
FROM nginxinc/nginx-unprivileged:stable-alpine
ARG REPO_COMMIT_ID='REPO_COMMIT_ID'
ARG REPO_ENDPOINT_URL='REPO_ENDPOINT_URL'
ENV REPO_COMMIT_ID=${REPO_COMMIT_ID}
ENV REPO_ENDPOINT_URL=${REPO_ENDPOINT_URL}
USER root
RUN addgroup -g 3000 appgroup \
&& adduser -u 10000 -g 3000 -h /home/appuser -D appuser
COPY ./entrypoint.sh /entrypoint.sh
WORKDIR /app
COPY ./.nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
HEALTHCHECK NONE
# add permissions for a user
RUN chown -R 10000:3000 /app && chmod -R 775 /app/
RUN chown 10000:3000 /entrypoint.sh && chmod -R 775 /entrypoint.sh
# Install bash for env variables inject script
RUN apk update && apk add --no-cache bash
# Make nginx owner of /usr/share/nginx/html/ and change to nginx user
RUN chown -R 10000:3000 /usr/share/nginx/html/ && chmod -R 775 /usr/share/nginx/html/
USER 10000:3000
EXPOSE 8080
ENTRYPOINT ["sh","/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]