/
Dockerfile
38 lines (29 loc) · 1.34 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
# FROM node:14.16-alpine3.13 also works here for a smaller image
FROM node:18.19.0-alpine3.19
# set our node environment, either development or production
# defaults to production, compose overrides this to development on build and run
ENV NODE_ENV production
EXPOSE 9293 9296
# you'll likely want the latest npm, regardless of node version, for speed and fixes
# but pin this version for the best stability
RUN npm i npm@latest -g
# install dependencies first, in a different location for easier app bind mounting for local development
WORKDIR /opt/service-fabrik-broker/broker
COPY broker/package.json package.json
COPY broker/.yarn .yarn
COPY broker/yarn.lock yarn.lock
COPY broker/.yarnrc.yml .yarnrc.yml
COPY broker/applications/osb-broker applications/osb-broker
COPY broker/applications/quota-app applications/quota-app
COPY broker/core core
COPY broker/data-access-layer data-access-layer
RUN mkdir logs
RUN yarn set version 2.4.1
RUN yarn cache clean
RUN yarn workspaces focus @sf/osb-broker @sf/quota-app --production
# copy in our source code last, as it changes the most
ENV CONF_DIR /opt/service-fabrik-broker/broker/config
ENV SETTINGS_PATH=$CONF_DIR/settings.yml
# the official node image provides an unprivileged user as a security best practice
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#non-root-user
# USER node