forked from RedisGears/RedisGears
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.arm
executable file
·89 lines (63 loc) · 2.69 KB
/
Dockerfile.arm
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
# BUILD redisfab/redisgears:${VERSION}-${ARCH}-${OSNICK}
ARG REDIS_VER=6.2.5
# OSNICK=bullseye|centos7|centos8|xenial|bionic
ARG OSNICK=bullseye
# OS=debian:bullseye-slim|centos:7|centos:8|ubuntu:xenial|ubuntu:bionic
ARG OS=debian:bullseye-slim
# ARCH=arm64v8|arm32v7
ARG ARCH=arm64v8
ARG PACK=0
ARG TEST=0
#----------------------------------------------------------------------------------------------
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis
FROM redisfab/xbuild:${ARCH}-${OS} AS builder
ARG OSNICK
ARG OS
ARG ARCH
ARG REDIS_VER
RUN [ "cross-build-start" ]
RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH}"
WORKDIR /build
COPY --from=redis /usr/local/ /usr/local/
ADD . /build
RUN ./deps/readies/bin/getupdates
RUN ./deps/readies/bin/getpy2
RUN ./system-setup.py
RUN make fetch SHOW=1
RUN make all SHOW=1
RUN ./getver > artifacts/VERSION
ARG PACK
ARG TEST
RUN if [ "$PACK" = "1" ]; then make pack; fi
RUN if [ "$TEST" = "1" ]; then \
TEST= make test ;\
tar -C /build/pytest/logs/ -czf /build/artifacts/pytest-logs-${ARCH}-${OSNICK}.tgz . ;\
fi
RUN [ "cross-build-end" ]
#----------------------------------------------------------------------------------------------
FROM redisfab/redis-xbuild:${REDIS_VER}-${ARCH}-${OSNICK}
RUN [ "cross-build-start" ]
ARG OSNICK
ARG OS
ARG ARCH
ARG REDIS_VER
ARG PACK
ENV REDIS_MODULES /var/opt/redislabs/lib/modules
RUN mkdir -p $REDIS_MODULES/ /var/opt/redislabs/artifacts
RUN chown -R redis:redis /var/opt/redislabs
COPY --from=builder --chown=redis:redis /build/redisgears.so $REDIS_MODULES/
COPY --from=builder --chown=redis:redis /build/bin/linux-${ARCH}-release/python3_* /var/opt/redislabs/modules/rg/python3/
COPY --from=builder --chown=redis:redis /build/bin/linux-${ARCH}-release/gears_python/gears_python.so /var/opt/redislabs/modules/rg/plugin/
# This is needed in order to allow extraction of artifacts from platform-specific build
# There is no use in removing this directory if $PACK !=1, because image side will only
# increase if `docker build --squash` if not used.
# COPY --from=builder /build/artifacts/VERSION /var/opt/redislabs/artifacts/VERSION
# COPY --from=builder /build/artifacts/snapshot/ /var/opt/redislabs/artifacts/snapshot
COPY --from=builder /build/artifacts/ /var/opt/redislabs/artifacts
RUN set -e ;\
cd /var/opt/redislabs/modules/rg/ ;\
ln -s python3 python3_`cat /var/opt/redislabs/artifacts/VERSION`
RUN if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y git; fi
RUN if [ ! -z $(command -v yum) ]; then yum install -y git; fi
CMD ["--loadmodule", "/var/opt/redislabs/lib/modules/redisgears.so", "Plugin", "/var/opt/redislabs/modules/rg/plugin/gears_python.so"]
RUN [ "cross-build-end" ]