44 lines
853 B
Docker
44 lines
853 B
Docker
# Build stage
|
|
FROM golang:1.18-alpine 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 dicom-proxy cmd/server/main.go
|
|
|
|
# Final stage
|
|
FROM alpine:3.15
|
|
|
|
# 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/dicom-proxy .
|
|
|
|
# Copy configuration
|
|
COPY config/config.yaml ./config/
|
|
|
|
# Create directory for credentials
|
|
RUN mkdir -p /app/credentials
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Set environment variable for config file location
|
|
ENV CONFIG_FILE=/app/config/config.yaml
|
|
|
|
# Run the application
|
|
ENTRYPOINT ["./dicom-proxy"] |