-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
66 lines (50 loc) · 2.21 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
# Build the app in image ‘builder’ (multi-stage builds)
FROM debian as builder
RUN apt-get update && apt-get install -y \
make cmake librdkafka-dev libssl-dev libjsoncpp-dev libmysqlcppconn-dev \
python3-launchpadlib clang clang-tools libz-dev g++
# Define working directory
WORKDIR /app
# Duplicate all necessary files
COPY . .
RUN rm -rf ./third_party/cppkafka/build || true
WORKDIR /app/third_party/cppkafka/build
RUN cmake /app/third_party/cppkafka
RUN make
# Compile Middlenebel
WORKDIR /app
RUN make all
# Use alpine server to deliver the application
# Not good for dinamic libraries FROM alpine:3.4
#FROM scratch
# FROM debian:buster
#FROM ubuntu:22.04
FROM debian
USER 0
RUN mkdir -p /usr/local/middlenebel/plugins
RUN mkdir -p /usr/local/middlenebel/cfgPlugins
RUN mkdir -p /usr/local/middlenebel/scripts/sql
RUN mkdir -p /lib/x86_64-linux-gnu
COPY --from=builder /app/third_party/cppkafka/build/src/lib/* /usr/lib/
COPY --from=builder /app/plugins/*.so /usr/local/middlenebel/plugins/
COPY --from=builder /app/cfgPlugins/* /usr/local/middlenebel/plugins/
COPY --from=builder /app/main /usr/local/middlenebel/main
COPY --from=builder /app/*.nebel /usr/local/middlenebel/
COPY --from=builder /app/scripts/*.nebel /usr/local/middlenebel/scripts/
COPY --from=builder /app/scripts/sql/*.sql /usr/local/middlenebel/scripts/sql/
#COPY --from=builder /lib/x86_64-linux-gnu/libjsoncpp.* /lib/x86_64-linux-gnu/
# COPY --from=builder /usr/lib/x86_64-linux-gnu/libmysqlcppconn.* /usr/lib/x86_64-linux-gnu/
# COPY --from=builder /usr/lib/x86_64-linux-gnu/librdkafka.* /usr/lib/x86_64-linux-gnu/
#COPY --from=builder /lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/
COPY --from=builder /usr/lib/x86_64-linux-gnu/* /usr/lib/x86_64-linux-gnu/
COPY --from=builder /usr/lib/x86_64-linux-gnu/* /usr/lib/x86_64-linux-gnu/
RUN chmod 775 /usr/local/middlenebel
RUN chmod 775 /usr/local/middlenebel/plugins/*
RUN chmod 775 /usr/local/middlenebel/*
RUN chmod 775 /usr/local/middlenebel/scripts
RUN chmod 776 /usr/local/middlenebel/scripts/*.nebel
RUN chmod 775 /usr/local/middlenebel/scripts/sql
RUN chmod 776 /usr/local/middlenebel/scripts/sql/*.sql
USER $CONTAINER_USER_ID
#ENTRYPOINT ["/usr/local/middlenebel/main"]
#RUN /usr/local/middlenebel/main