Files
icecast-ripper/Dockerfile
Dmitrii Andreev 23f6f258d5
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
Docker / build (push) Has been cancelled
golangci-lint / lint (push) Has been cancelled
bumped go version; disable download
2025-04-07 19:21:20 +03:00

41 lines
1.1 KiB
Docker

# Stage 1: Build the application
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Copy the source code
COPY . .
# Build the application
# CGO_ENABLED=0 is important for static linking, especially with sqlite and alpine
# -ldflags="-w -s" strips debug information, reducing binary size
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o /icecast-ripper ./cmd/icecast-ripper/main.go
# Stage 2: Create the final lightweight image
FROM alpine:latest
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /icecast-ripper /app/icecast-ripper
# Create directories for recordings, temp files, and database if needed inside the container
# These should ideally be mounted as volumes in production
RUN mkdir -p /app/recordings /app/temp
# Expose the server port
EXPOSE 8080
# Set default environment variables (can be overridden)
ENV RECORDINGS_PATH=/app/recordings
ENV TEMP_PATH=/app/temp
ENV SERVER_ADDRESS=:8080
ENV LOG_LEVEL=info
ENV CHECK_INTERVAL=1m
ENV RSS_FEED_URL=http://localhost:8080/rss
# ENV STREAM_URL= # Required: Must be set at runtime
# Command to run the application
ENTRYPOINT ["/app/icecast-ripper"]