-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
51 lines (38 loc) · 1.75 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
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
RUN NEWKEY=`/usr/src/app/jwt-key-gen.sh` && sed -i "s/^SECRET_ACCESS_TOKEN=.*/SECRET_ACCESS_TOKEN=$NEWKEY/" /usr/src/app/.env
## 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 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.2"