2025-03-05 10:55:37 -06:00
|
|
|
# Build stage
|
|
|
|
FROM golang:alpine AS builder
|
|
|
|
|
|
|
|
# Install build dependencies
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
|
|
|
# Set working directory
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
|
|
# Copy only go.mod and go.sum first to leverage Docker caching
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
# Copy the entire repository
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Build the tsidp binary
|
|
|
|
RUN go build -o /bin/tsidp ./cmd/tsidp
|
|
|
|
|
|
|
|
# Final stage
|
|
|
|
FROM alpine:latest
|
|
|
|
|
|
|
|
# Create necessary directories
|
|
|
|
RUN mkdir -p /var/lib/tsidp
|
|
|
|
|
|
|
|
# Copy binary from builder stage
|
|
|
|
COPY --from=builder /bin/tsidp /app/tsidp
|
|
|
|
|
|
|
|
# Set working directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Environment variables
|
|
|
|
ENV TAILSCALE_USE_WIP_CODE=1 \
|
2025-03-28 14:17:13 -07:00
|
|
|
TS_HOSTNAME=idp \
|
2025-03-05 10:55:37 -06:00
|
|
|
TS_STATE_DIR=/var/lib/tsidp
|
|
|
|
|
|
|
|
# Expose the default port
|
|
|
|
EXPOSE 443
|
|
|
|
|
|
|
|
# Run the application
|
2025-03-28 14:17:13 -07:00
|
|
|
ENTRYPOINT ["/app/tsidp"]
|