-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (25 loc) · 903 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
29
30
31
32
33
FROM node:20 AS tailwind-builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build-css
FROM golang:1.23.2-bookworm AS go-builder
WORKDIR /app
COPY . .
RUN go mod download
RUN go install github.com/a-h/templ/cmd/[email protected]
RUN apt-get update -qq && \
apt-get install -y ca-certificates && \
update-ca-certificates
RUN templ generate
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags "-X shave/internal/version.Version=$(git describe --tags --always --dirty)" -o server ./cmd/server
RUN CGO_ENABLED=1 GOOS=linux go build -o migration ./cmd/migration
FROM golang:1.23.2-bookworm
WORKDIR /app
COPY --from=tailwind-builder /app/public ./public
COPY --from=go-builder /app/server .
COPY --from=go-builder /app/migration .
COPY --from=go-builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
EXPOSE 8080
ENTRYPOINT ["/bin/sh", "-c", "./migration && ./server"]