-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
61 lines (45 loc) · 1.87 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM node:20-alpine3.20 AS builder
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm ci
COPY client/package.json client/package-lock.json client/
RUN npm ci --prefix client
COPY server/package.json server/package-lock.json server/
RUN npm ci --prefix server
COPY . ./
ARG SERVER_PORT=5050
ARG VERSION
ARG NEXT_PUBLIC_API_ORIGIN=http://localhost:$SERVER_PORT
RUN npm run batch:writeVersion -- $VERSION
RUN npm run build
RUN npm ci --omit=dev --prefix server
FROM node:20-alpine3.20
WORKDIR /usr/src/app
ARG CLIENT_PORT=5051
ARG SSL_PORT=5052
ENV PORT=5050
ENV CLIENT_PORT=$CLIENT_PORT
ENV SSL_PORT=$SSL_PORT
ENV COGNITO_ACCESS_KEY=magnito-access-key
ENV COGNITO_SECRET_KEY=magnito-secret-key
ENV COGNITO_REGION=ap-northeast-1
ENV COGNITO_USER_POOL_ID=ap-northeast-1_default
ENV COGNITO_USER_POOL_CLIENT_ID=default-client-id
ENV DATABASE_URL=file:../../data/app.db
ENV SMTP_HOST=inbucket
ENV SMTP_PORT=2500
ENV SMTP_USER=fake_mail_user
ENV SMTP_PASS=fake_mail_password
COPY --chown=node package.json ./
COPY --chown=node server/package.json server/package-lock.json ./server/
COPY --chown=node --from=builder /usr/src/app/client/out client/out/
COPY --chown=node --from=builder /usr/src/app/server/certificates server/certificates/
COPY --chown=node --from=builder /usr/src/app/server/node_modules server/node_modules/
COPY --chown=node --from=builder /usr/src/app/server/index.js server/index.js
COPY --chown=node --from=builder /usr/src/app/server/prisma server/prisma/
COPY --chown=node --from=builder /usr/src/app/data data/
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD wget --quiet --spider http://127.0.0.1:$PORT/public/health && wget --quiet --spider http://127.0.0.1:$CLIENT_PORT && wget --quiet --spider --no-check-certificate https://127.0.0.1:$SSL_PORT || exit 1
EXPOSE ${PORT} ${CLIENT_PORT} ${SSL_PORT}
VOLUME ["/usr/src/app/data"]
USER node
CMD ["npm", "start"]