weiro/Dockerfile

43 lines
717 B
Docker
Raw Normal View History

2026-02-28 00:02:15 +00:00
# Build stage
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Install the build dependencies
RUN apk update && \
apk add nodejs npm make gcc libc-dev
# Copy source code
COPY . .
# Build the frontend
RUN make frontend
# Build the application
RUN CGO_ENABLED=1 GOOS=linux go build -o weiro .
# Runtime stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates
RUN mkdir -p /data
2026-03-05 11:27:14 +00:00
RUN mkdir -p /scratch
2026-02-28 00:02:15 +00:00
WORKDIR /root/
# Copy the binary from builder
COPY --from=builder /app/weiro .
COPY --from=builder /app/static ./static
COPY --from=builder /app/views ./views
ENV DATA_DIR=/data
2026-03-05 11:27:14 +00:00
ENV SCRATCH_DIR=/scratch
2026-02-28 00:02:15 +00:00
EXPOSE 3000
CMD ["./weiro"]