Add docker file for running on server.

This commit is contained in:
douwe
2025-08-06 02:21:02 +02:00
parent 357d2d48bc
commit 44530f3287
7 changed files with 143 additions and 14 deletions

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
# Use an official Ubuntu as a parent image
FROM ubuntu:latest
# Set the working directory in the container to /app
WORKDIR /server
# Install necessary packages, including CMake, a C++ compiler, and wget
RUN apt-get update && \
apt-get install -y cmake g++ make wget && \
apt-get clean;
# Copy the current directory contents into the container at /app
COPY . /server
# Download Crow library
RUN wget https://github.com/CrowCpp/Crow/archive/refs/heads/master.zip -O crow.zip && \
unzip crow.zip && \
mv Crow-master/crow/include/crow.h /usr/local/include/
# Make the build directory
RUN mkdir -p build && cd build
# Run CMake to configure the build
RUN cmake ..
# Build the project
RUN make
# Expose port 8888 for the web server
EXPOSE 8888
# Command to run the executable
CMD ["./douwco_web"]