-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.api
35 lines (29 loc) · 1.03 KB
/
Dockerfile.api
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
FROM node:18-buster as builder
RUN mkdir apidoc backend
# Build API Documentation
WORKDIR apidoc
COPY apidoc .
RUN yarn install
RUN yarn build
# Build the backend
WORKDIR /backend
COPY backend/app ./app
COPY backend/public/logo.png ./
COPY backend/codegen.yml backend/*.json backend/yarn.lock ./
RUN yarn install
RUN yarn generate:types && yarn build
RUN mkdir build/rest/docs && cp app/graphql/schema.graphql build/graphql
## Build the application
FROM node:18-alpine3.17 AS prolang
ENV NODE_ENV=production
WORKDIR /app
COPY --chown=node:node --from=builder /backend/package.json /backend/yarn.lock ./
RUN yarn install --production && \
mkdir -p public/spec && \
chown node:node -R public node_modules
COPY --chown=node:node --from=builder /backend/build ./src
COPY --chown=node:node --from=builder /apidoc/build/index.html ./src/rest/docs
COPY --chown=node:node --from=builder /backend/logo.png ./public
COPY --chown=node:node --from=builder /apidoc/dist/openapi.yaml ./public/spec/prolang.yaml
EXPOSE 5991
CMD ["node", "src/index.js"]