# Use an official Node.js runtime as the base image
FROM node:18-alpine

# Create root application folder
WORKDIR /usr/src/streamingserver

# Copy package.json and package-lock.json to the container
COPY package*.json ./

# Install application dependencies
RUN npm install

# Install FFmpeg. This is needed to convert the video to HLS
RUN apk add --no-cache ffmpeg

# /usr/bin/ffmpeg is the default path for ffmpeg, copy it to /app
RUN cp /usr/bin/ffmpeg ./

# Copy the rest of the application code
COPY . .

# Expose a port
EXPOSE 3008

# Specify the command to run your application
CMD [ "node", "server.js" ]