35 lines
663 B
Docker
35 lines
663 B
Docker
# Build Stage
|
|
FROM golang:1.23-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy go mod and sum files
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the server binary
|
|
# CGO_ENABLED=0 ensures a static binary
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o grokway-server ./cmd/server
|
|
|
|
# Final Stage
|
|
FROM alpine:latest
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy the binary from builder
|
|
COPY --from=builder /app/grokway-server .
|
|
|
|
# Copy static files (needed for landing page checks)
|
|
COPY --from=builder /app/cmd/server/static ./cmd/server/static
|
|
|
|
# Expose ports
|
|
# 2222 for SSH Tunneling
|
|
# 8080 for HTTP Proxy
|
|
EXPOSE 2222 8080
|
|
|
|
# Run the binary
|
|
CMD ["./grokway-server"]
|