# pq-ftp/server/Dockerfile

# Base Image: Ubuntu 22.04
FROM ubuntu:22.04

# Avoid interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies for building C++ and OQS
# Install dependencies for building C++ and OQS
RUN apt-get update && apt-get install -y \
    git \
    cmake \
    g++ \
    make \
    libssl-dev \
    zlib1g-dev \
    ninja-build \
    && rm -rf /var/lib/apt/lists/*

# Clone and install liboqs
WORKDIR /opt
RUN git clone --branch 0.14.0 https://github.com/open-quantum-safe/liboqs.git
WORKDIR /opt/liboqs
RUN mkdir build && cd build && \
    cmake -DOQS_USE_OPENSSL=OFF -GNinja .. && \
    ninja && \
    ninja install

# Set up the working directory for our server code
WORKDIR /app

# Copy the server source code and Makefile
COPY ./src /app/src
COPY Makefile /app/

# Compile the server
RUN make

# Create directories for transfers and logs
RUN mkdir -p /transfer && mkdir -p /logs

# Set the entrypoint for the container
CMD [ "./bin/server" ]
