forked from gocronx-team/gocron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.gocron
More file actions
42 lines (28 loc) · 988 Bytes
/
Dockerfile.gocron
File metadata and controls
42 lines (28 loc) · 988 Bytes
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
# Frontend build stage
FROM node:20-alpine AS frontend
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app/web/vue
COPY web/vue/package.json web/vue/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY web/vue ./
RUN pnpm build
# Backend build stage
FROM golang:1.26-alpine AS builder
# Install build dependencies for CGO and SQLite
RUN apk add --no-cache git gcc musl-dev sqlite-dev
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
# Copy frontend build files first
COPY --from=frontend /app/web/vue/dist ./web/vue/dist
# Then copy the rest of the project
COPY . .
# Build with CGO enabled for SQLite support
# Use -p=1 to reduce memory usage during compilation
RUN CGO_ENABLED=1 go build -p=1 -ldflags="-s -w" -trimpath -o gocron ./cmd/gocron
FROM alpine:latest
# Install runtime dependencies for SQLite
RUN apk add --no-cache ca-certificates sqlite-libs
COPY --from=builder /app/gocron /gocron
EXPOSE 5920
ENTRYPOINT ["/gocron", "web"]