added Dockerfile
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
FROM golang:1.26-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go mod and sum files
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
# Download dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build statically
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags='-w -s' -o mdhost .
|
||||
|
||||
# Final scratch image
|
||||
FROM scratch
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /app/mdhost /mdhost
|
||||
|
||||
# Run the application - directories will be bind-mounted from host
|
||||
CMD ["/mdhost"]
|
||||
Reference in New Issue
Block a user