-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
55 lines (40 loc) · 1.71 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
FROM registry.access.redhat.com/ubi8/nodejs-20:latest AS BUILD_IMAGE
### BEGIN REMOTE SOURCE
# Use the COPY instruction only inside the REMOTE SOURCE block
# Use the COPY instruction only to copy files to the container path $REMOTE_SOURCES_DIR/activemq-artemis-jolokia-api-server/app
ARG REMOTE_SOURCES_DIR=/tmp/remote_source
RUN mkdir -p $REMOTE_SOURCES_DIR/activemq-artemis-jolokia-api-server/app
WORKDIR $REMOTE_SOURCES_DIR/activemq-artemis-jolokia-api-server/app
# Copy package.json and yarn.lock to the container
COPY package.json package.json
COPY yarn.lock yarn.lock
ADD . $REMOTE_SOURCES_DIR/activemq-artemis-jolokia-api-server/app
RUN command -v yarn || npm i -g yarn
### END REMOTE SOURCE
USER root
## Set directory
RUN mkdir -p /usr/src/
RUN cp -r $REMOTE_SOURCES_DIR/activemq-artemis-jolokia-api-server/app /usr/src/
WORKDIR /usr/src/app
## Install dependencies
RUN yarn install --network-timeout 1000000
## Build application
RUN yarn build
## Gather productization dependencies
RUN yarn install --network-timeout 1000000 --modules-folder node_modules_prod --production
FROM registry.access.redhat.com/ubi8/nodejs-20-minimal:latest
COPY --from=BUILD_IMAGE /usr/src/app/dist /usr/share/amq-spp/dist
COPY --from=BUILD_IMAGE /usr/src/app/.env /usr/share/amq-spp/.env
COPY --from=BUILD_IMAGE /usr/src/app/node_modules_prod /usr/share/amq-spp/node_modules
WORKDIR /usr/share/amq-spp
USER root
RUN echo "node /usr/share/amq-spp/dist/app.js" > run.sh
RUN chmod +x run.sh
USER 1001
ENV NODE_ENV=production
CMD ["node", "dist/app.js"]
## Labels
LABEL name="artemiscloud/activemq-artemis-jolokia-api-server"
LABEL description="ActiveMQ Artemis Jolokia api-server"
LABEL maintainer="Howard Gao <[email protected]>"
LABEL version="0.1.1"