forked from mark3labs/anyabi.xyz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
28 lines (24 loc) · 811 Bytes
/
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
# syntax=docker/dockerfile:1
# Stage 1: Build the static files
FROM node:16.17.0-alpine3.15 as ui-builder
WORKDIR /ui
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY /ui/package.json /ui/pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile
COPY /ui .
RUN pnpm run build
# Stage 2: Build the Go binary
FROM golang:1.18.2-alpine3.14 AS builder
WORKDIR /app
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
RUN update-ca-certificates
COPY . .
COPY --from=ui-builder /ui/build ./ui/build/
RUN go mod download
RUN CGO_ENABLED=0 go build -o pocketbase .
FROM scratch
WORKDIR /app
COPY --from=builder /app/pocketbase /app/pocketbase
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Start Pocketbase
CMD [ "/app/pocketbase", "serve", "--http=0.0.0.0:5000" ]