-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
41 lines (29 loc) · 1.06 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
### Build stage
FROM node:20.13.1-alpine3.18 AS builder
ENV HOME=/home/app
ENV APP_PATH=$HOME/ndla-frontend
ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
# Copy necessary files for installing dependencies
COPY yarn.lock package.json .yarnrc.yml $APP_PATH/
# Enable yarn
RUN corepack enable
# Run yarn before src copy to enable better layer caching
WORKDIR $APP_PATH
RUN yarn install --immutable
# Copy necessary source files for server and client build
COPY babel.config.cjs tsconfig.json vite.config.ts panda.config.ts eslint.config.mjs postcss.config.cjs $APP_PATH/
COPY iframe-article.html iframe-embed.html index.html lti.html error.html $APP_PATH/
COPY scripts $APP_PATH/scripts
COPY src $APP_PATH/src
COPY public $APP_PATH/public
# Build client code
RUN yarn run build
### Run stage
FROM node:20.13.1-alpine3.18
RUN apk add py-pip jq && pip install awscli
COPY run-ndla-frontend.sh /
WORKDIR /home/app/ndla-frontend
COPY --from=builder /home/app/ndla-frontend/build build
ENV NODE_ENV=production
CMD ["/run-ndla-frontend.sh", "node build/server.mjs"]