Files
dex/docker/Dockerfile
T
zeekay 777bec57cf chore: normalize naming to LX across codebase
Apply consistent naming conventions throughout:
- Standardize product name to "LX" in documentation
- Update README files and API documentation
- Apply linter fixes to all source files
- Update Hummingbot connector documentation
2025-12-11 21:04:37 -08:00

50 lines
1009 B
Docker

# Multi-stage build for LX
FROM golang:1.23-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git make
# Set working directory
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o lx-dex ./cmd/demo
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dex-server ./cmd/dex-server
# Final stage
FROM alpine:latest
# Install ca-certificates for HTTPS
RUN apk --no-cache add ca-certificates
# Create non-root user
RUN addgroup -g 1000 -S dex && \
adduser -u 1000 -S dex -G dex
# Set working directory
WORKDIR /app
# Copy binaries from builder
COPY --from=builder /app/lx-dex /app/lx-dex
COPY --from=builder /app/dex-server /app/dex-server
# Change ownership
RUN chown -R dex:dex /app
# Switch to non-root user
USER dex
# Expose ports
EXPOSE 8080 8081
# Default command
CMD ["/app/dex-server"]