-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
59 lines (47 loc) · 2.11 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
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal:1-129.1726695172
# Some version information
LABEL maintainer="Laurent Broudoux <laurent@microcks.io>" \
org.opencontainers.image.authors="Laurent Broudoux <laurent@microcks.io>" \
org.opencontainers.image.title="Microcks Hub" \
org.opencontainers.image.description="Microcks is Open Source cloud-native native tool for API Mocking and Testing" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.documentation="https://github.com/microcks/hub.microcks.io" \
io.artifacthub.package.readme-url="https://raw.githubusercontent.com/microcks/hub.microcks.io/master/README.md"
ARG MOCKS_REPO=https://github.com/microcks/community-mocks
ARG MOCKS_BRANCH=master
ENV APP_ROOT=/app
WORKDIR ${APP_ROOT}
# root for build stages
USER root
# install git lib
RUN microdnf install ca-certificates git -y \
&& microdnf update -y \
&& microdnf clean all
# frontend
COPY frontend/ ${APP_ROOT}/frontend
RUN cd ${APP_ROOT}/frontend; npm install \
&& export NODE_OPTIONS=--openssl-legacy-provider \
&& npm run-script build-prod \
&& rm -rdf ${APP_ROOT}/frontend/node_modules ${APP_ROOT}/frontend/.cache-loader /opt/app-root/src/.npm /tmp/v8-compile-cache-0
# server
COPY server/ ${APP_ROOT}/server
RUN cd ${APP_ROOT}/server \
&& npm install --unsafe-perm \
&& rm -rdf /opt/app-root/src/.npm /tmp/v8-compile-cache-0
# prepare upstream mocks for server processing
#RUN mkdir -p ${APP_ROOT}/server/data/community-mocks \
# && mkdir -p /tmp/community-mocks \
# && git clone -b $MOCKS_BRANCH $MOCKS_REPO /tmp/community-mocks \
# && cp -a /tmp/community-mocks/artifacts ${APP_ROOT}/server/data/community-mocks/artifacts \
# && rm -rfd /tmp/community-mocks
### Setup user for build execution and application runtime
ENV HOME=${APP_ROOT}
RUN chmod -R u+x ${APP_ROOT}/server/bin && \
chgrp -R 0 ${APP_ROOT} && \
chmod -R g=u ${APP_ROOT} /etc/passwd
### Containers should NOT run as root as a good practice
USER 1001
# Finalize
WORKDIR ${APP_ROOT}/server
ENTRYPOINT [ "/app/server/bin/uid_entrypoint" ]
EXPOSE 4000