Spaces:
Sleeping
Sleeping
| # Multi-stage build for Go programs | |
| FROM golang:1.24-alpine AS go-builder | |
| WORKDIR /go-build | |
| # Copy Go module files | |
| COPY go.mod go.sum ./ | |
| # Download Go dependencies | |
| RUN go mod download | |
| # Copy Go source files | |
| COPY func/dk_nhl_go ./func/dk_nhl_go | |
| COPY func/fd_nhl_go ./func/fd_nhl_go | |
| COPY func/dk_nba_go ./func/dk_nba_go | |
| COPY func/fd_nba_go ./func/fd_nba_go | |
| COPY func/dk_nfl_go ./func/dk_nfl_go | |
| COPY func/fd_nfl_go ./func/fd_nfl_go | |
| COPY func/showdown_go ./func/showdown_go | |
| # Build the Go programs for Linux | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o dk_nhl_seed ./func/dk_nhl_go/NHL_seed_frames.go | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o fd_nhl_seed ./func/fd_nhl_go/NHL_seed_frames.go | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o dk_nba_seed ./func/dk_nba_go/NBA_seed_frames.go | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o fd_nba_seed ./func/fd_nba_go/NBA_seed_frames.go | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o dk_nfl_seed ./func/dk_nfl_go/NFL_seed_frames.go | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o fd_nfl_seed ./func/fd_nfl_go/NFL_seed_frames.go | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o showdown_seed ./func/showdown_go/showdown_seed_frames.go | |
| # Python stage | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt ./ | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # Copy Python source files (only what's needed) | |
| COPY src/ ./src/ | |
| # Copy compiled Go binaries from builder stage | |
| COPY --from=go-builder /go-build/dk_nhl_seed ./dk_nhl_go/NHL_seed_frames | |
| COPY --from=go-builder /go-build/fd_nhl_seed ./fd_nhl_go/NHL_seed_frames | |
| COPY --from=go-builder /go-build/dk_nba_seed ./dk_nba_go/NBA_seed_frames | |
| COPY --from=go-builder /go-build/fd_nba_seed ./fd_nba_go/NBA_seed_frames | |
| COPY --from=go-builder /go-build/dk_nfl_seed ./dk_nfl_go/NFL_seed_frames | |
| COPY --from=go-builder /go-build/fd_nfl_seed ./fd_nfl_go/NFL_seed_frames | |
| COPY --from=go-builder /go-build/showdown_seed ./showdown_go/showdown_seed_frames | |
| # Make Go binaries executable | |
| RUN chmod +x ./dk_nhl_go/NHL_seed_frames ./fd_nhl_go/NHL_seed_frames | |
| RUN chmod +x ./dk_nba_go/NBA_seed_frames ./fd_nba_go/NBA_seed_frames | |
| RUN chmod +x ./dk_nfl_go/NFL_seed_frames ./fd_nfl_go/NFL_seed_frames | |
| RUN chmod +x ./showdown_go/showdown_seed_frames | |
| # Create .streamlit directory for config | |
| RUN mkdir -p .streamlit | |
| # Expose Streamlit port | |
| EXPOSE 8501 | |
| # Health check | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health | |
| # Run Streamlit app | |
| ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |