-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
86 lines (63 loc) · 1.72 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
84
85
86
# Base Image
FROM alpine:3.19 as base
WORKDIR /app
# Node Image
FROM base as node
RUN apk add nodejs
# pnpm Image
FROM node as pnpm
WORKDIR /src
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/web/package.json ./apps/web/
COPY apps/indexer/package.json ./apps/indexer/
ENV CI=true
RUN <<EOF
set -e
apk add npm
npm install -g corepack
corepack enable
pnpm install
EOF
# Build Gol2 Web Server
FROM pnpm as build-web
COPY apps/web/public ./apps/web/public/
COPY apps/web/app ./apps/web/app/
COPY apps/web/postcss.config.js ./apps/web/
COPY apps/web/tailwind.config.js ./apps/web/
COPY apps/web/tsconfig.json ./apps/web/
COPY apps/web/vite.config.ts ./apps/web/
COPY tsconfig.options.json tsconfig.projects.json ./
RUN <<EOF
set -e
pnpm run --filter=./apps/web build
pnpm deploy --filter=./apps/web --prod /app
EOF
# Gol2 Web Server TARGET Image
FROM node as web
COPY --from=build-web /app ./
CMD ["./node_modules/.bin/remix-serve", "./build/server/index.js"]
EXPOSE 3000
# Build Gol2 Indexer
FROM pnpm as build-indexer
COPY apps/indexer/src ./apps/indexer/src/
COPY apps/indexer/tsconfig.json ./apps/indexer/
COPY tsconfig.options.json tsconfig.projects.json ./
RUN <<EOF
set -e
pnpm run --filter=./apps/indexer build
pnpm deploy --filter=./apps/indexer --prod /app
EOF
# Gol2 Indexer TARGET Image
FROM node as indexer
COPY --from=build-indexer /app ./
CMD ["./dist/index.mjs"]
# dbmate Image
FROM ghcr.io/amacneil/dbmate as dbmate
# Gol2 Migrations TARGET Image
FROM base as migrations
RUN apk add --no-cache postgresql-client tzdata
COPY --from=dbmate /usr/local/bin/dbmate /usr/local/bin/dbmate
COPY db ./db/
ENV DBMATE_NO_DUMP_SCHEMA=true
ENTRYPOINT ["/usr/local/bin/dbmate"]
CMD ["--wait", "up"]