This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathDockerfile.release
More file actions
125 lines (99 loc) · 3.8 KB
/
Dockerfile.release
File metadata and controls
125 lines (99 loc) · 3.8 KB
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
FROM ubuntu:24.04 AS base
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}
ARG CUSTOM_MIRROR="https://archive.ubuntu.com/ubuntu"
ARG CUDA=false
ARG CACHE_PRESENT=false
# Install runtime requirements for MAGE
COPY scripts/install_runtime_requirements.sh /install_runtime_requirements.sh
RUN chmod +x /install_runtime_requirements.sh && \
/install_runtime_requirements.sh --ci --target-arch ${TARGETARCH} \
--py-version ${PY_VERSION} --custom-mirror ${CUSTOM_MIRROR} \
--cuda ${CUDA} && \
rm /install_runtime_requirements.sh
# 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 /home/memgraph -s /bin/bash memgraph && \
dpkg -i memgraph-${TARGETARCH}.deb && \
rm memgraph-${TARGETARCH}.deb
ENV LD_LIBRARY_PATH=/usr/lib/memgraph/query_modules
# Copy modules
RUN mkdir -p /usr/lib/memgraph/query_modules/
COPY mage.tar.gz /tmp/mage.tar.gz
RUN tar -xzvf /tmp/mage.tar.gz -C /usr/lib/memgraph/ && rm /tmp/mage.tar.gz
# copy script to convert to dev container
COPY make-dev-container.sh /make-dev-container.sh
COPY python/requirements.txt /tmp/requirements.txt
COPY python/requirements-gpu.txt /tmp/requirements-gpu.txt
COPY cpp/memgraph/src/auth/reference_modules/requirements.txt /tmp/auth_module-requirements.txt
USER memgraph
COPY --chown=memgraph:memgraph ./scripts/install_python_requirements.sh /home/memgraph/install_python_requirements.sh
COPY --chown=memgraph:memgraph ./wheels /tmp/wheels
RUN cd $HOME && \
if [ "$TARGETARCH" = "arm64" ]; then \
pip install --no-cache-dir /tmp/wheels/pymgclient-*.whl --break-system-packages; \
fi && \
chmod +x /home/memgraph/install_python_requirements.sh && \
./install_python_requirements.sh --arch ${TARGETARCH} --ci --cuda ${CUDA} --cache-present ${CACHE_PRESENT} --wheel-cache-dir /tmp/wheels && \
rm /home/memgraph/install_python_requirements.sh && \
rm -rf /tmp/wheels
FROM base 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}
ARG CUSTOM_MIRROR
RUN if [ -n "$CUSTOM_MIRROR" ]; then \
sed -E -i \
-e "/^URIs:/ s#${CUSTOM_MIRROR}/ubuntu/#https://archive.ubuntu.com/ubuntu/#g" \
-e "/^URIs:/ s#${CUSTOM_MIRROR}/ubuntu/#https://security.ubuntu.com/ubuntu/#g" \
/etc/apt/sources.list.d/ubuntu.sources; \
fi
USER memgraph
EXPOSE 7687
ENTRYPOINT ["/usr/lib/memgraph/memgraph"]
CMD [""]
FROM base AS relwithdebinfo
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}
ARG CUSTOM_MIRROR
# Add gdb
RUN apt-get update && apt-get install -y \
gdb libc6-dbg \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy entire mage repo
COPY --chown=memgraph:memgraph ./ /mage/
# Copy heaptrack and install it properly
COPY heaptrack /tmp/heaptrack
RUN cp -vr /tmp/heaptrack/* /usr/ && rm -rf /tmp/heaptrack
RUN if [ -n "$CUSTOM_MIRROR" ]; then \
sed -E -i \
-e "/^URIs:/ s#${CUSTOM_MIRROR}/ubuntu/#https://archive.ubuntu.com/ubuntu/#g" \
-e "/^URIs:/ s#${CUSTOM_MIRROR}/ubuntu/#https://security.ubuntu.com/ubuntu/#g" \
/etc/apt/sources.list.d/ubuntu.sources; \
fi
# Copy script from Memgraph repo to run Memgraph with GDB - override the entrypoint to use it
COPY cpp/memgraph/release/docker/run_with_gdb.sh /usr/lib/memgraph/run_with_gdb.sh
USER memgraph
EXPOSE 7687
ENTRYPOINT ["/usr/lib/memgraph/memgraph"]
CMD [""]