Added docker file
This commit is contained in:
parent
4a6b79db17
commit
97112d99dd
40
Dockerfile
Normal file
40
Dockerfile
Normal file
|
|
@ -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"]
|
||||
Loading…
Reference in a new issue