-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathDockerfile
More file actions
85 lines (70 loc) · 3.71 KB
/
Copy pathDockerfile
File metadata and controls
85 lines (70 loc) · 3.71 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
FROM debian:trixie-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /tmp
# Install build tools
# libatomic1: required for 32-bit targets (386, arm/v5, arm/v7)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake make git binutils-dev ca-certificates pkg-config libatomic1 \
libboost-dev libcrypto++-dev libglib2.0-dev libreadline-dev libwxgtk3.2-dev zlib1g-dev libpng-dev libupnp-dev \
&& rm -rf /var/lib/apt/lists/*
# Build aMule from source (AMULE_REF can be a tag, branch, or commit SHA)
ARG AMULE_REF=3.0.1
RUN git init -q amule-src && \
git -C amule-src fetch --depth 1 --tags https://github.com/amule-org/amule.git ${AMULE_REF} && \
git -C amule-src checkout -q FETCH_HEAD && \
# libatomic1 only ships libatomic.so.1; find_library(atomic) needs the unversioned symlink
so="$(find /usr/lib -name 'libatomic.so.1' -print -quit)" && [ -n "$so" ] && ln -sf "$(basename "$so")" "${so%.1}" ; \
# Debian's libupnp-dev ships a broken UPNP.cmake (non-existent /usr/COMPONENT
# include path) that breaks the build on non-x86_64/aarch64 arches; drop it so
# aMule falls back to pkg-config for libupnp.
rm -rf /usr/lib/*/cmake/UPNP /usr/lib/cmake/UPNP /usr/lib64/cmake/UPNP ; \
cmake -B amule-build amule-src \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=NO \
-DBUILD_MONOLITHIC=NO \
-DBUILD_DAEMON=YES \
-DBUILD_AMULECMD=YES \
-DBUILD_WEBSERVER=YES \
-DBUILD_ALCC=YES \
-DENABLE_IP2COUNTRY=NO \
-DENABLE_UPNP=YES \
-DENABLE_NLS=NO && \
cmake --build amule-build -j"$(nproc)" && \
cmake --install amule-build && \
rm -rf /tmp/*
FROM debian:trixie-slim
ENV DEBIAN_FRONTEND=noninteractive
LABEL maintainer="ngosang@hotmail.es"
# Copy binaries and Web UI
COPY --from=builder /usr/bin/alcc /usr/bin/amulecmd /usr/bin/amuled /usr/bin/amuleweb /usr/bin/ed2k /usr/bin/
COPY --from=builder /usr/share/amule /usr/share/amule
# Install runtime dependencies and remove unnecessary locale files
RUN apt-get update && apt-get install -y --no-install-recommends \
libcrypto++8t64 libreadline8t64 libgcc-s1 libstdc++6 libpng16-16t64 libwxbase3.2-1t64 libglib2.0-0t64 libupnp17t64 \
libatomic1 libbinutils ca-certificates curl tzdata procps pwgen s6 cron systemd-standalone-sysusers \
&& rm -rf /var/lib/apt/lists/* /usr/share/locale /usr/share/doc/* /usr/share/doc-base /usr/share/lintian && \
# Check binaries are OK (fail the build if any shared library is missing)
for bin in alcc amulecmd amuled amuleweb ed2k; do \
if ldd "/usr/bin/$bin" | grep -q "not found"; then echo "ERROR: missing shared libraries in $bin:"; ldd "/usr/bin/$bin"; exit 1; fi; \
done
# Use the built-in C.UTF-8 locale so amuled handles non-ASCII paths correctly
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
# Add entrypoint and S6 services
COPY --chmod=755 docker/entrypoint.sh docker/amule-config.sh docker/amule-mods.sh /home/amule/
COPY --chmod=755 docker/services.d/ /etc/services.d/
WORKDIR /home/amule
EXPOSE 4711/tcp 4712/tcp 4662/tcp 4665/udp 4672/udp
ENTRYPOINT ["/home/amule/entrypoint.sh"]
# HELP
#
# => Build Docker image (stable release, AMULE_REF defaults to the latest stable tag)
# docker build -t ngosang/amule:test --progress=plain .
#
# => Build a develop image from a specific aMule branch or commit
# docker build --build-arg AMULE_REF=<branch-or-commit> -t ngosang/amule:test --progress=plain .
#
# => Build multi-arch Docker image
# docker buildx create --use
# docker buildx build -t ngosang/amule:test --progress=plain --platform linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x .