39 lines
723 B
Docker
39 lines
723 B
Docker
# Build stage
|
|
FROM golang:1.22 AS builder
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy go mod and sum files
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ohif-proxy cmd/server/main.go
|
|
|
|
# Final stage
|
|
FROM alpine:3.18
|
|
|
|
# Install CA certificates for HTTPS connections
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy binary from build stage
|
|
COPY --from=builder /app/ohif-proxy .
|
|
|
|
# Copy configuration and create dirs
|
|
COPY config/config.yaml ./config/
|
|
RUN mkdir -p /app/credentials
|
|
|
|
# Expose port
|
|
EXPOSE 5555
|
|
|
|
# Run the application
|
|
CMD ["./ohif-proxy"] |