-
Notifications
You must be signed in to change notification settings - Fork 2
/
api.Dockerfile
77 lines (60 loc) · 2.67 KB
/
api.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# First step: build the assets
FROM node:18-alpine AS builder
WORKDIR /app
ADD package.json yarn.lock ./
ADD ./patches ./patches/
ADD ./apis/core/package.json ./apis/core/
ADD ./apis/errors/package.json ./apis/errors/
ADD ./apis/shared-dimensions/package.json ./apis/shared-dimensions/
ADD ./packages/core/package.json ./packages/core/
ADD ./packages/express/package.json ./packages/express/
ADD ./packages/model/package.json ./packages/model/
ADD ./packages/testing/package.json ./packages/testing/
ADD ./packages/express-rdf-request/package.json ./packages/express-rdf-request/
ADD ./packages/shacl-middleware/package.json ./packages/shacl-middleware/
# for every new package foo add:
# ADD ./packages/foo/package.json ./packages/foo/
# install and build backend
RUN yarn install --frozen-lockfile && yarn cache clean
COPY . .
RUN rm -rf ./ui
RUN rm -rf ./cli
RUN yarn tsc --outDir dist --module CommonJS
FROM node:18-alpine
WORKDIR /app
ADD package.json yarn.lock ./
ADD ./apis/core/package.json ./apis/core/
ADD ./apis/errors/package.json ./apis/errors/
ADD ./apis/shared-dimensions/package.json ./apis/shared-dimensions/
ADD ./packages/core/package.json ./packages/core/
ADD ./packages/express/package.json ./packages/express/
ADD ./packages/model/package.json ./packages/model/
ADD ./packages/testing/package.json ./packages/testing/
ADD ./packages/express-rdf-request/package.json ./packages/express-rdf-request/
ADD ./packages/shacl-middleware/package.json ./packages/shacl-middleware/
# for every new package foo add
#ADD ./packages/foo/package.json ./packages/foo/
RUN yarn install --production --frozen-lockfile && yarn cache clean
COPY --from=builder /app/dist/apis ./apis/
COPY --from=builder /app/dist/packages/ ./packages/
ADD apis/core/hydra/*.ttl ./apis/core/hydra/
ADD apis/shared-dimensions/hydra/*.ttl ./apis/shared-dimensions/hydra/
ADD apis/shared-dimensions/lib/domain/shared-dimension/importShapes.ttl ./apis/shared-dimensions/lib/domain/shared-dimension/
ADD apis/shared-dimensions/lib/store/shapes.ttl ./apis/shared-dimensions/lib/store/shapes.ttl
ADD apis/shared-dimensions/lib/shapes/*.ttl ./apis/shared-dimensions/lib/shapes/
# for every new hydra api "foo" add
#ADD apis/foo/hydra/*.ttl ./apis/foo/hydra/
RUN apk add --no-cache tini
ENTRYPOINT ["tini", "--", "node"]
# build with `docker build --build-arg COMMIT=$(git rev-parse HEAD)`
ARG COMMIT
ENV SENTRY_RELEASE=cube-creator-api@$COMMIT
# Have some logs by default
# This should be kept in sync with .lando.yml
ENV DEBUG creator*,hydra*,hydra-box*,labyrinth*
EXPOSE 45670
# USER nobody. Needs to be a numeric UID, else the "runAsNonRoot" security
# directive in Kubernetes does not work.
USER 65534
WORKDIR /app/apis
CMD ["core"]