-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
78 lines (59 loc) · 1.95 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Best OS ^_^
FROM archlinux:latest
# Install dependencies (Openssl-1.1 is used to avoid conflicts in msquic libs)
RUN pacman -Syu --noconfirm && \
pacman -S --noconfirm cmake \
protobuf \
libpqxx \
openssl-1.1 \
boost numactl \
libevent \
git \
go \
ninja \
curl \
make \
gcc \
libcrypto.so \
abseil-cpp
# Create a non-root user
RUN useradd -m builduser && echo "builduser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Switch to the non-root user
USER builduser
# Download the pre-built release tarball of cassandra-cpp-driver
WORKDIR /tmp
RUN curl -L https://github.com/datastax/cpp-driver/archive/refs/tags/2.16.1.tar.gz -o cpp-driver-2.16.1.tar.gz
# Extract the tarball
RUN tar -xzf cpp-driver-2.16.1.tar.gz
# Set working directory to the extracted source
WORKDIR /tmp/cpp-driver-2.16.1
# Build the cassandra-cpp-driver using Ninja
RUN mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -DCMAKE_CXX_FLAGS="-Wno-error=deprecated-declarations" .. && ninja
# Switch to root to install the driver
USER root
RUN cd /tmp/cpp-driver-2.16.1/build && ninja install
# Clean up temporary files
RUN rm -rf /tmp/cpp-driver-2.16.1 /tmp/cpp-driver-2.16.1.tar.gz
# Set the working directory for your application
WORKDIR /app
# Copy your application files into the container
COPY . .
# Make sure the compile script is executable and run it
RUN chmod +x ./compile.proto.sh
RUN ./compile.proto.sh
# Navigate to the tests directory
WORKDIR /app/tests
# Clean up existing build directory (if necessary)
RUN rm -rf build
# Create a new build directory
RUN mkdir build
WORKDIR /app/tests/build
# Run cmake to generate build files and build the server
RUN cmake -DUSE_SCYLLA_DB=ON -G Ninja ..
RUN ninja
# Expose the port (if applicable)
EXPOSE 6121
# Set the default command to run your server
CMD ["./server"]
#To run docker container on your VPS, you can use the following command:
#docker run -d --network host <image_name>