-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.ubi-minimal
56 lines (46 loc) · 1.95 KB
/
Dockerfile.ubi-minimal
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
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4-1227.1725849298
# Some version information
LABEL maintainer="Laurent Broudoux <laurent@microcks.io>" \
org.opencontainers.image.authors="Laurent Broudoux <laurent@microcks.io>" \
org.opencontainers.image.title="Microcks Postman runtime" \
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/microcks-postman-runtime" \
io.artifacthub.package.readme-url="https://raw.githubusercontent.com/microcks/microcks-postman-runtime/master/README.MD"
ENV NODEJS_VERSION=20
# Install Node runtime
RUN INSTALL_PKGS="nodejs npm tar which" \
&& microdnf -y module disable nodejs \
&& microdnf -y module enable nodejs:$NODEJS_VERSION \
&& microdnf -y --nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS \
&& node -v | grep -qe "^v$NODEJS_VERSION\." && echo "Found VERSION $NODEJS_VERSION" \
&& microdnf clean all \
&& rm /var/lib/rpm/rpmdb.sqlite \
&& rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.*
# Set the running environment as production
ENV NODE_ENV production
ENV LOG_LEVEL info
ENV PORT 3000
# Define working directory
ENV APP_ROOT=/app
WORKDIR ${APP_ROOT}
# root for build stages
USER root
# Copy files and install dependencies
COPY lib/ ${APP_ROOT}/lib
COPY bin/ ${APP_ROOT}/bin
COPY package*.json ${APP_ROOT}
COPY app.js ${APP_ROOT}
RUN cd ${APP_ROOT} \
&& npm install \
&& rm -rdf ${APP_ROOT}/.npm /tmp/v8-compile-cache-0
### Setup user for build execution and application runtime
ENV HOME=${APP_ROOT}
RUN chmod -R u+x ${APP_ROOT}/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
# Executing defaults
EXPOSE 3000
ENTRYPOINT [ "/app/bin/uid_entrypoint" ]