-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (43 loc) · 1.41 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (43 loc) · 1.41 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
FROM --platform=$BUILDPLATFORM node:24 AS frontend
ARG TARGETOS
ARG TARGETARCH
WORKDIR /surmai
RUN corepack enable
COPY package.json .
COPY pnpm-lock.yaml .
RUN pnpm install --frozen-lockfile
ADD src src
ADD public public
COPY eslint.config.js .
COPY index.html .
COPY postcss.config.js .
COPY tsconfig.app.json .
COPY tsconfig.json .
COPY tsconfig.node.json .
COPY vite.config.ts .
RUN pnpm run build
FROM --platform=$BUILDPLATFORM golang:1.26.2-alpine3.23 AS backend
ARG TARGETOS
ARG TARGETARCH
WORKDIR /build
# Copy the go.mod and go.sum files to the /build directory
COPY backend/go.mod .
COPY backend/go.sum .
RUN go mod download
COPY backend .
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o surmai-backend
FROM --platform=$BUILDPLATFORM golang:1.26.2-alpine3.23 AS litestream
ADD https://github.com/benbjohnson/litestream/releases/download/v0.3.13/litestream-v0.3.13-linux-amd64.tar.gz /tmp/litestream.tar.gz
RUN tar -C /usr/local/bin -xzf /tmp/litestream.tar.gz
FROM alpine:3.22
RUN apk add --no-cache tzdata
COPY backend/init.sh /pb/init.sh
COPY backend/litestream-init.sh /pb/litestream-init.sh
COPY backend/datasets /datasets
COPY --from=frontend /surmai/dist /pb_public
COPY --from=backend /build/surmai-backend /pb/surmai-backend
COPY --from=litestream /usr/local/bin/litestream /usr/local/bin/litestream
COPY litestream.yaml /etc/litestream.yml
EXPOSE 8080
# start PocketBase
CMD ["/pb/litestream-init.sh"]