-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
65 lines (50 loc) · 1.6 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
FROM ubuntu:20.04 AS build-env
# Set the timezone
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Configure env
ARG SECRET_KEY
ARG DB_HOST
ARG DB_PORT
ARG DB_NAME
ARG DB_USER
ARG DB_PASSWORD
ENV SECRET_KEY=$SECRET_KEY
ENV DB_HOST=$DB_HOST
ENV DB_PORT=$DB_PORT
ENV DB_NAME=$DB_NAME
ENV DB_USER=$DB_USER
ENV DB_PASSWORD=$DB_PASSWORD
# Update and install necessary packages
RUN apt-get update
RUN apt-get install -y redis-server libhiredis-dev git
RUN apt-get install -y cmake g++ gcc libjsoncpp-dev uuid-dev openssl
RUN apt-get install -y libssl-dev zlib1g-dev libbz2-dev liblzma-dev
RUN apt-get install -y postgresql postgresql-contrib postgresql-all
RUN apt clean && rm -rf /var/lib/apt/lists/*
# Clone the Drogon repository
RUN git clone https://github.com/drogonframework/drogon
# Build and install the Drogon library
RUN cd drogon && \
git submodule update --init && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make && make install
# Clone JWT-CPP repository
RUN git clone https://github.com/Thalhammer/jwt-cpp.git
# Build and install the JWT-CPP library
RUN cd jwt-cpp && mkdir build && cd build && cmake .. && make && make install
# Copy the application code
COPY . .
# Install brcrypt
RUN git clone https://github.com/hilch/Bcrypt.cpp.git
# Run scripts
RUN chmod +x scripts -R
RUN ./scripts/create_dot_env.sh
RUN ./scripts/create_model_json.sh
# Build app
RUN cmake . && make && chmod +x drogon_user_service
# Expose port 8000 for the app
EXPOSE 8000
# Start the app
CMD ["./drogon_user_service", "--action=run-server"]