-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
83 lines (61 loc) · 1.85 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM node:18.19.0-alpine3.19 AS builder
RUN npm --version
WORKDIR /app/back
COPY ./back/package.json .
COPY ./back/package-lock.json .
COPY ./back/knexfile.js .
COPY ./back/migrations ./migrations
COPY ./back/src ./src
COPY ./back/tsconfig.json .
RUN npm ci
RUN npm run build
WORKDIR /app/front
COPY ./front/package.json .
COPY ./front/package-lock.json .
COPY ./front/postcss.config.js .
COPY ./front/svelte.config.js .
COPY ./front/tailwind.config.js .
COPY ./front/tsconfig.json .
COPY ./front/vite.config.ts .
COPY ./front/src ./src
COPY ./front/static ./static
ENV PUBLIC_MICROEYE_SAMEORIGIN=1
RUN npm ci
RUN npm run build
FROM node:18.19.0-alpine3.19
USER root
RUN apk add --no-cache postgresql postgresql-contrib
RUN mkdir /var/lib/postgresql/data
RUN chown -R postgres: /var/lib/postgresql
RUN mkdir /run/postgresql
RUN chown -R postgres: /run/postgresql
USER postgres
RUN initdb -D /var/lib/postgresql/data
VOLUME /var/lib/postgresql/data
USER root
RUN apk add --no-cache supervisor
RUN adduser -D microeye
USER microeye
WORKDIR /app/back
COPY --from=builder /app/back/dist ./dist
COPY --from=builder /app/back/package.json ./
COPY --from=builder /app/back/package-lock.json ./
COPY --from=builder /app/back/knexfile.js ./
COPY --from=builder /app/back/migrations ./migrations
RUN npm ci --only=production
WORKDIR /app/front
COPY --from=builder /app/front/build ./build
COPY --from=builder /app/front/package.json ./
ENV MICROEYE_FRONT_HANDLER_PATH=/app/front/build/handler.js
ENV MICROEYE_DB_NAME=postgres
ENV MICROEYE_MUST_START_FRONT=true
ENV NODE_ENV=production
ENV PUBLIC_MICROEYE_SAMEORIGIN=1
ENV MICROEYE_ADMIN_PASSWORD=microeye
ENV MICROEYE_DISABLE_AUTH=false
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 3000
STOPSIGNAL SIGINT
USER root
WORKDIR /app
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]