-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
45 lines (39 loc) · 996 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
34
35
36
37
38
39
40
41
42
43
44
45
# Setup Node & Pnpm
FROM node:20-slim AS vite-builder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN pnpm install -g pnpm
# Build the Vite bundle
COPY ./web /app/web
WORKDIR /app/web
RUN rm -rf node_modules
RUN pnpm install --frozen-lockfile
RUN pnpm run build
# Build the Go app #
FROM golang:1.23.1 AS go-builder
COPY ./internal /app/internal
COPY ./cmd /app/cmd
COPY ./common /app/common
COPY ./go.mod /app/go.mod
COPY ./go.sum /app/go.sum
COPY --from=vite-builder /app/web/dist /app/internal/server/dist
WORKDIR /app
RUN go mod download
RUN go build -o forkman ./cmd/forkman/main.go
# Setup the final image
FROM ubuntu:22.04 AS final
WORKDIR /app
# Install dependencies required for CGO
RUN apt-get update && apt-get install -y \
ca-certificates \
libc6 \
libstdc++6 \
curl \
tzdata \
&& rm -rf /var/lib/apt/lists/*
COPY --from=go-builder /app/forkman /app/forkman
RUN chmod +x /app/forkman
# Run the app
EXPOSE 8080
CMD ["./forkman"]