-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathDockerfile.no_ML
144 lines (117 loc) · 4.92 KB
/
Dockerfile.no_ML
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
ARG PY_VERSION_DEFAULT=3.12
ARG MGBUILD_IMAGE
FROM $MGBUILD_IMAGE as builder
USER root
ARG TARGETARCH
ARG PY_VERSION_DEFAULT
ARG BUILD_TYPE
ENV BUILD_TYPE=${BUILD_TYPE}
ENV PY_VERSION ${PY_VERSION_DEFAULT}
# Essentials for production/dev
RUN apt-get update && apt-get install -y \
libcurl4 `memgraph` \
libpython${PY_VERSION} `memgraph` \
libssl-dev `memgraph` \
openssl `memgraph` \
build-essential `mage-memgraph` \
cmake `mage-memgraph` \
curl `mage-memgraph` \
g++ `mage-memgraph` \
python3 `mage-memgraph` \
python3-pip `mage-memgraph` \
python3-setuptools `mage-memgraph` \
python3-dev `mage-memgraph` \
clang `mage-memgraph` \
git `mage-memgraph` \
unixodbc-dev `mage-memgraph` \
libboost-all-dev `mage-memgraph` \
uuid-dev \
gdb \
procps \
libc6-dbg \
libxmlsec1-dev xmlsec1 \
--no-install-recommends \
&& ln -s /usr/bin/$(ls /usr/bin | grep perf) /usr/bin/perf \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY memgraph-${TARGETARCH}.deb .
RUN dpkg -i memgraph-${TARGETARCH}.deb && rm memgraph-${TARGETARCH}.deb
ENV LD_LIBRARY_PATH /usr/lib/memgraph/query_modules
WORKDIR /mage
COPY . /mage
# hacks so we can do everything under the `memgraph` user
RUN chown -R memgraph: /mage && \
mkdir -pv /usr/lib/memgraph/query_modules && \
chown -R memgraph: /usr/lib/memgraph/query_modules
USER memgraph
#MAGE
SHELL ["/bin/bash", "-c"]
RUN source /opt/toolchain-v6/activate && curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& export PATH="$HOME/.cargo/bin:${PATH}" \
&& python3 -m pip install --no-cache-dir -r /mage/python/tests/requirements.txt --break-system-packages \
&& python3 -m pip install --no-cache-dir -r /mage/python/requirements_no_ml.txt --break-system-packages \
&& python3 -m pip install --no-cache-dir -r /usr/lib/memgraph/auth_module/requirements.txt --break-system-packages \
&& python3 /mage/setup build -p /usr/lib/memgraph/query_modules/ --no-ml --cpp-build-flags CMAKE_BUILD_TYPE=${BUILD_TYPE} \
&& chown -R memgraph: /mage/e2e && \
rm -fr /var/lib/memgraph/.cache/pip
# Memgraph listens for Bolt Protocol on this port by default.
EXPOSE 7687
FROM ubuntu:24.04 as prod
USER root
ARG TARGETARCH
ARG PY_VERSION_DEFAULT=3.12
ARG MAGE_COMMIT
ARG BUILD_TYPE
ENV BUILD_TYPE=${BUILD_TYPE}
ENV PY_VERSION ${PY_VERSION_DEFAULT}
ENV MAGE_COMMIT=${MAGE_COMMIT}
# Install only runtime dependencies that are needed
RUN apt-get update && apt-get install -y \
libcurl4 `memgraph` \
libpython${PY_VERSION} `memgraph` \
libssl-dev `memgraph` \
openssl `memgraph` \
python3 `mage-memgraph` \
python3-pip `mage-memgraph` \
python3-setuptools `mage-memgraph` \
python3-dev `mage-memgraph` \
libc6-dbg \
adduser \
unixodbc-dev \
libgomp1 \
libaio1t64 \
--no-install-recommends \
&& ln -s /usr/bin/$(ls /usr/bin | grep perf) /usr/bin/perf \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
if [ "${TARGETARCH}" = "arm64" ]; then \
ln -s /usr/lib/aarch64-linux-gnu/libaio.so.1t64 /usr/lib/aarch64-linux-gnu/libaio.so.1; \
else \
ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1; \
fi
# install memgraph
COPY memgraph-${TARGETARCH}.deb .
# fix `memgraph` UID and GID for compatibility with previous Debian releases
RUN groupadd -g 103 memgraph && \
useradd -u 101 -g memgraph -m -d /var/lib/memgraph memgraph && \
dpkg -i memgraph-${TARGETARCH}.deb && \
rm memgraph-${TARGETARCH}.deb
ENV LD_LIBRARY_PATH /usr/lib/memgraph/query_modules
#copy modules
COPY --from=builder /usr/lib/memgraph/query_modules/ /usr/lib/memgraph/query_modules/
COPY --from=builder /usr/lib/memgraph/auth_module/ /usr/lib/memgraph/auth_module/
#copy python build
COPY --from=builder /usr/local/lib/python${PY_VERSION}/ /usr/local/lib/python${PY_VERSION}/
COPY --from=builder --chown=memgraph:memgraph /var/lib/memgraph/.local/ /var/lib/memgraph/.local/
#copy e2e tests
COPY --from=builder --chown=memgraph:memgraph /mage/e2e/ /mage/e2e/
COPY --from=builder --chown=memgraph:memgraph /mage/e2e_correctness/ /mage/e2e_correctness/
COPY --from=builder --chown=memgraph:memgraph /mage/test_e2e_correctness.py /mage/test_e2e_correctness.py
COPY --from=builder --chown=memgraph:memgraph /mage/run_e2e_correctness_tests.sh /mage/run_e2e_correctness_tests.sh
# Copy requirements
COPY --from=builder --chown=memgraph:memgraph /mage/python/requirements_no_ml.txt /mage/python/requirements_no_ml.txt
COPY --from=builder --chown=memgraph:memgraph /mage/python/tests/requirements.txt /mage/python/tests/requirements.txt
# copy script to convert to dev container
COPY --from=builder /mage/make-dev-container.sh /make-dev-container.sh
USER memgraph
EXPOSE 7687
ENTRYPOINT ["/usr/lib/memgraph/memgraph"]
CMD [""]