-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (42 loc) · 1.58 KB
/
Dockerfile
File metadata and controls
71 lines (42 loc) · 1.58 KB
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
ARG VERSION
ARG OUTRIG_VERSION="0.9.0"
# --- Frontend ---
# Docs: https://pnpm.io/docker
FROM node:23 AS front-base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY ./frontend /src
WORKDIR /src
FROM front-base AS front-prod-deps
ENV CI=true
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM front-base AS front-builder
ENV CI=true
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build
FROM front-base AS front-final
COPY --from=front-prod-deps /src/node_modules /src/node_modules
COPY --from=front-builder /src/dist /src/dist
# --- Backend ---
FROM golang:1.25.2 AS back-builder
COPY . /src
WORKDIR /src
COPY --from=front-final /src/dist /src/spa/public
RUN GOEXPERIMENT=jsonv2 CGO_ENABLED=0 go build -o pedago-dashboard -ldflags="-s -w -X 'base-website.Version=${VERSION}'" ./cmd/api
# --- Final ---
FROM debian:12.11
WORKDIR /app
ENV MIGRATIONS_DIR="/app/migrations"
ENV CI="true"
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* && apt-get clean
RUN curl -sf https://outrig.run/install.sh | OUTRIG_VERSION=${OUTRIG_VERSION} sh \
&& mv ~/.local/bin/outrig /bin/
RUN curl -sSf https://atlasgo.sh | sh
COPY ./ent/migrate/migrations /app/migrations
COPY ./scripts/docker/api-entrypoint.sh /usr/local/bin/entrypoint.sh
COPY --from=back-builder /src/pedago-dashboard /usr/local/bin/pedago-dashboard
RUN chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/usr/local/bin/pedago-dashboard", "start"]