1
+ # Optimized for layer cache hits to speed up builds
2
+
3
+ FROM node:18-alpine3.19 as dep-install-stage
4
+
5
+ WORKDIR /app
6
+ RUN apk update -q && apk --no-cache add libc6-compat python3 make g++ autoconf automake libtool -q
7
+ COPY package.json yarn.lock ./
8
+ COPY common/package.json common/
9
+ COPY client/package.json client/
10
+ COPY server/package.json server/
11
+ RUN yarn install --frozen-lockfile
12
+
1
13
FROM node:18-alpine3.19 as build-stage
2
14
ARG GIT_COMMIT
3
15
ENV GIT_COMMIT=$GIT_COMMIT
4
16
5
- WORKDIR /usr/app
6
-
17
+ WORKDIR /app
7
18
RUN apk update -q && apk --no-cache add libc6-compat python3 make g++ autoconf automake libtool -q
8
- COPY . .
9
- RUN yarn
10
- RUN yarn run build
11
-
19
+ COPY tsconfig.json ./
20
+ COPY common common
21
+ COPY client client
22
+ COPY server server
23
+ COPY --from=dep-install-stage /app /app
24
+ RUN yarn workspace ott-common run build && yarn workspace ott-client run build && yarn workspace ott-server run build
25
+ RUN rm -rf packages/ott-vis*
12
26
RUN rm -rf node_modules && yarn install --production=true
13
27
14
28
FROM node:18-alpine3.19 as production-stage
15
- ARG DEPLOY_TARGET
16
29
17
- WORKDIR /usr/app/
30
+ WORKDIR /app
31
+ COPY --from=build-stage /app /app
32
+ RUN rm -rf client/public client/src client/.browserslistrc .eslintrc.js .gitignore client/vite.config.js client/babel.config.js docker-compose.yml /root/.npm tools crates
33
+
34
+ FROM node:18-alpine3.19 as docker-stage
35
+ # For use in docker-compose
18
36
37
+ WORKDIR /app
19
38
ENV NODE_ENV production
20
39
ENV FFPROBE_PATH /usr/bin/ffprobe
21
-
22
40
RUN apk update -q && apk --no-cache add curl ffmpeg -q
41
+ COPY docker/scripts/wait_for_db.sh /app/wait_for_db.sh
42
+ COPY --from=production-stage /app /app
43
+ HEALTHCHECK --interval=30s --timeout=3s CMD ( curl -f http://localhost:8080/api/status || exit 1 )
23
44
24
- COPY --from=build-stage /usr/app/ /usr/app/
25
-
26
- RUN rm -rf client/public client/src client/.browserslistrc .eslintrc.js .gitignore client/vite.config.js docker-compose.yml /root/.npm deploy crates tools
45
+ CMD ["/bin/sh" , "wait_for_db.sh" , "--" , "yarn" , "run" , "start" ]
27
46
28
- COPY deploy/base.toml /usr/app/env/
29
- COPY deploy/$DEPLOY_TARGET.toml /usr/app/env/production.toml
47
+ FROM node:18-alpine3.19 as deploy-stage
48
+ # For deployment on Fly
49
+ ARG DEPLOY_TARGET
30
50
31
- # Healthcheck API, WEB, REDIS
51
+ WORKDIR /app
52
+ ENV NODE_ENV production
53
+ ENV FFPROBE_PATH /usr/bin/ffprobe
54
+ RUN apk update -q && apk --no-cache add curl ffmpeg -q
55
+ COPY --from=production-stage /app /app
56
+ COPY deploy/base.toml /app/env/
57
+ COPY deploy/$DEPLOY_TARGET.toml /app/env/production.toml
32
58
HEALTHCHECK --interval=30s --timeout=3s CMD ( curl -f http://localhost:8080/api/status || exit 1 )
33
59
34
- # Start Server
35
- CMD ["yarn" , "workspace" , "ott-server" , "run" , "start-lean" ]
60
+ CMD ["yarn" , "workspace" , "ott-server" , "run" , "start-lean" ]
0 commit comments