-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
99 lines (63 loc) · 2.19 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
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
ARG DEBIAN_VERSION=12.8
FROM ghcr.io/cnpem/lnls-debian-epics-7:v0.12.0-dev AS build-image
FROM debian:${DEBIAN_VERSION}-slim AS base
ARG RUNDIR
ARG ENTRYPOINT=/usr/local/bin/lnls-run
ARG RUNTIME_PACKAGES
ARG RUNTIME_TAR_PACKAGES
ARG RUNTIME_PIP_PACKAGES
COPY --from=build-image /etc/apt/apt.conf.d/90-disable-sandbox.conf /etc/apt/apt.conf.d/90-disable-sandbox.conf
RUN apt update -y && \
apt install -y --no-install-recommends \
libreadline8 \
libtirpc3 \
busybox \
netcat-openbsd \
procserv \
$([ -n "$RUNTIME_PIP_PACKAGES" ] && echo pip) \
$RUNTIME_PACKAGES && \
busybox --install && \
apt clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=build-image /usr/local/lib /usr/local/lib
COPY --from=build-image /usr/local/bin/lnls-get-n-unpack /usr/local/bin/lnls-get-n-unpack
RUN lnls-get-n-unpack -r $RUNTIME_TAR_PACKAGES && \
ldconfig
RUN if [ -n "$RUNTIME_PIP_PACKAGES" ]; then \
pip install --break-system-packages $RUNTIME_PIP_PACKAGES; \
fi
COPY --from=build-image /usr/local/bin/lnls-run /usr/local/bin/lnls-run
WORKDIR ${RUNDIR}
RUN ln -s ${ENTRYPOINT} ./entrypoint
ENTRYPOINT ["./entrypoint"]
FROM base AS no-build
COPY --from=build-image /opt /opt
FROM build-image AS build-stage
ARG REPONAME
ARG BUILD_PACKAGES
ARG BUILD_TAR_PACKAGES
RUN if [ -n "$BUILD_PACKAGES" ]; then \
apt update && \
apt install -y --no-install-recommends $BUILD_PACKAGES; \
fi
RUN lnls-get-n-unpack -r $BUILD_TAR_PACKAGES
WORKDIR /opt/${REPONAME}
COPY . .
RUN cp $EPICS_RELEASE_FILE configure/RELEASE
RUN rm -rf .git/
FROM build-stage AS dynamic-build
ARG JOBS=1
ARG RUNDIR
ARG SKIP_TESTS
RUN make distclean && make -j ${JOBS} && make $([ "$SKIP_TESTS" != 1 ] && echo runtests) && make clean && make -C ${RUNDIR}
FROM base AS dynamic-link
COPY --from=dynamic-build /opt /opt
FROM build-stage AS static-build
ARG JOBS=1
ARG RUNDIR
ARG SKIP_TESTS
RUN echo STATIC_BUILD=YES >> configure/CONFIG_SITE
RUN make distclean && make -j ${JOBS} && make $([ "$SKIP_TESTS" != 1 ] && echo runtests) && make clean && make -C ${RUNDIR}
FROM base AS static-link
ARG REPONAME
COPY --from=static-build /opt/${REPONAME} /opt/${REPONAME}