-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
58 lines (48 loc) · 1.37 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Using Ubuntu 20.04 as the base image
FROM ubuntu:20.04
# Set the DEBIAN_FRONTEND environment variable to noninteractive to disable prompts
ARG DEBIAN_FRONTEND=noninteractive
# Set the working directory
WORKDIR /usr/src/app
# Print a message to the console
RUN echo "Starting build process..."
# Install CMake, a C++ compiler, LLVM, and required tools
RUN apt-get update && \
apt-get install -y \
wget \
git \
cmake \
clang \
gcc \
g++ \
build-essential \
libboost-system-dev \
libboost-thread-dev \
libboost-program-options-dev \
libboost-test-dev \
lsb-release \
software-properties-common \
gnupg && \
apt-get purge python3-lldb-14 -y && \
wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh 17 && \
rm -rf /var/lib/apt/lists/*
# Copy the source files into the working directory
COPY CMakeLists.txt ./
COPY src/ ./src/
COPY include/ ./include/
COPY app/ ./app/
COPY tests/ ./tests/
# Run CMake to generate the buildsystem
RUN cmake -S . -B build
# Build the project
RUN cmake --build build
# Run the tests
RUN ./build/bin/test_lexer
RUN ./build/bin/test_parser
# Add the build/bin directory to the PATH
ENV PATH="/usr/src/app/build/bin:${PATH}"
# Provide instructions for using the compiler
RUN echo "S-Lang build complete!"
RUN echo "Use `./slang [options] [file]` to use the compiler"