# Use an official ubuntu-based image
FROM hatiolab/operato-env:latest

# Set the working directory to /app
WORKDIR /app

# Copy application and configuration files to the working directory
COPY . .

# Run the yarn install command to install dependencies
RUN yarn install

# Install required packages (necessary for locale setup)
RUN apt-get update && apt-get install -y locales tzdata

# Generate the en_US.UTF-8 locale
RUN locale-gen en_US.UTF-8

# Set environment variables for locale and timezone
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
ENV TZ=UTC

# Set timezone to UTC (using tzdata)
RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo "UTC" > /etc/timezone

# Expose port 3000 to allow access to the application outside the container
EXPOSE 3000

# Command to run the application using yarn
CMD [ "yarn", "run", "serve" ]
