# Sử dụng base image Ubuntu làm nền tảng tương thích tốt với file thực thi linux-amd64
FROM ubuntu:22.04

# Cài đặt curl và ca-certificates để tải file qua HTTPS bảo mật
RUN apt-get update && apt-get install -y \
    curl \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Thiết lập thư mục làm việc trong container
WORKDIR /app

# Tải xuống phiên bản stream-server mới nhất từ GitHub Releases
RUN curl -L -o stream-server https://github.com/perpetus/stream-server/releases/latest/download/stream-server-linux-amd64

# Cấp quyền thực thi cho file binary vừa tải về
RUN chmod +x stream-server

# Mở port 11470 theo yêu cầu của ứng dụng
EXPOSE 11470

# Lệnh khởi chạy ứng dụng khi container bắt đầu chạy
CMD ["./stream-server"]