diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..95faeea --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +# 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 + +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 + +EXPOSE 3000 + +CMD ["./weiro"]