-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (35 loc) · 1.1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Use an official Go runtime as the base image
FROM golang:1.23 AS go-builder
# Set the working directory inside the container
WORKDIR /app
# Copy the Go module files
COPY go.mod .
# # Download Go dependencies
# RUN go mod download
# Copy the Go source code
COPY main.go .
# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux go build -o karaoke-server .
# Use a Python runtime as the base image for the final stage
FROM python:3.9-slim
# Set the working directory inside the container
WORKDIR /app
# Install system dependencies (gcc, build-essential, ffmpeg, etc.)
RUN apt-get update && apt-get install -y \
gcc \
build-essential \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Copy the Python script and requirements file
COPY karaoke_generator.py .
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the Go binary from the builder stage
COPY --from=go-builder /app/karaoke-server .
# Create the temporary directory
RUN mkdir -p /app/temp
# Expose the HTTP server port
EXPOSE 8080
# Run the Go HTTP server
CMD ["./karaoke-server"]