|
1 | 1 | # Start from an Ubuntu base
|
2 | 2 | FROM ubuntu:22.04
|
3 | 3 |
|
| 4 | +# --- SRCML SETUP --- |
| 5 | + |
4 | 6 | # Set non-interactive mode for apt
|
5 | 7 | ENV DEBIAN_FRONTEND=noninteractive
|
6 | 8 |
|
7 |
| -# Install required packages |
| 9 | +# Install required packages (incl. Python for server) |
8 | 10 | RUN apt-get update && \
|
9 | 11 | apt-get install -y \
|
10 | 12 | curl zip g++ make ninja-build antlr libantlr-dev \
|
11 | 13 | libxml2-dev libxml2-utils libxslt1-dev \
|
12 | 14 | libarchive-dev libssl-dev libcurl4-openssl-dev \
|
13 | 15 | cpio man file dpkg-dev \
|
14 |
| - cmake && \ |
| 16 | + cmake python3 python3-pip && \ |
15 | 17 | rm -rf /var/lib/apt/lists/*
|
16 | 18 |
|
17 | 19 | # Add srcML include files
|
18 | 20 | RUN curl -L http://www.sdml.cs.kent.edu/build/srcML-1.0.0-Boost.tar.gz | \
|
19 | 21 | tar xz -C /usr/local/include
|
20 | 22 |
|
21 |
| -# Create build directory |
22 | 23 | RUN mkdir -p /srcml/build
|
23 | 24 |
|
24 |
| -# Copy your source code into the container (update `.` as needed) |
25 | 25 | COPY ./srcml /srcml
|
26 | 26 |
|
27 |
| -# Set working directory |
28 | 27 | WORKDIR /srcml/build
|
29 | 28 |
|
30 |
| -# Configure and build using CMake and Ninja |
31 | 29 | RUN cmake .. -G Ninja && \
|
32 | 30 | cmake --build . --config Release --target install
|
33 | 31 |
|
34 |
| -# Set ldconfig so installed libs are available |
| 32 | +# Set ldconfig so installed libs are linked and available |
35 | 33 | RUN ldconfig
|
36 | 34 |
|
37 |
| -# Validate srcML works (can be used in entrypoint or test phase) |
38 |
| -RUN srcml --version && \ |
39 |
| - srcml --text="int a;" -l C++ |
| 35 | +# --- SERVER SETUP --- |
| 36 | + |
| 37 | +# Install Python packages for server |
| 38 | +RUN pip3 install fastapi uvicorn python-multipart |
| 39 | + |
| 40 | +# Add FastAPI server app |
| 41 | +COPY ./server/server.py /app/server.py |
| 42 | +WORKDIR /app |
| 43 | + |
| 44 | +# Expose port |
| 45 | +EXPOSE 8000 |
40 | 46 |
|
41 |
| -# Default command (can be overridden) |
42 |
| -ENTRYPOINT [ "srcml" ] |
| 47 | +# Start FastAPI server |
| 48 | +CMD ["uvicorn", "server:app", "--port", "8000"] |
43 | 49 |
|
0 commit comments