-
Notifications
You must be signed in to change notification settings - Fork 36
/
Dockerfile-release
107 lines (87 loc) · 2.9 KB
/
Dockerfile-release
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
FROM alpine:3.17 AS build
WORKDIR /tmp/workdir
ARG PREFIX="/tmp/install"
ARG BUILD_PACKAGES=" \
boost-dev \
bzip2 \
ca-certificates \
cmake \
coreutils \
curl \
g++ \
libarchive-dev \
libconfig-dev \
make \
openssl-dev \
pkgconfig \
tar \
zlib-dev"
RUN apk add --no-cache --update ${BUILD_PACKAGES}
# WT
ARG WT_VERSION=4.9.1
RUN \
DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://github.com/emweb/wt/archive/${WT_VERSION}.tar.gz && \
tar -x --strip-components=1 -f ${WT_VERSION}.tar.gz
RUN \
DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_EXAMPLES=OFF -DENABLE_LIBWTTEST=OFF -DCONNECTOR_FCGI=OFF -DINSTALL_THEMES=OFF && \
make -j$(nproc) && \
make install
# Fileshelter
COPY . /tmp/fileshelter/
RUN \
DIR=/tmp/fileshelter && mkdir -p ${DIR} && cd ${DIR} && \
PKG_CONFIG_PATH=/tmp/install/lib/pkgconfig CXXFLAGS="-I${PREFIX}/include" LDFLAGS="-L${PREFIX}/lib -Wl,--rpath-link=${PREFIX}/lib" cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_PREFIX_PATH=${PREFIX} && \
LD_LIBRARY_PATH=${PREFIX}/lib VERBOSE=1 make && \
LD_LIBRARY_PATH=${PREFIX}/lib make test && \
make install -j$(nproc) && \
mkdir -p ${PREFIX}/etc/ && \
cp conf/fileshelter.conf ${PREFIX}/etc
# Now copy all the stuff installed in a new folder (/tmp/fakeroot/)
RUN \
mkdir -p /tmp/fakeroot/bin && \
for bin in ${PREFIX}/bin/fileshelter*; \
do \
strip --strip-all $bin && \
cp $bin /tmp/fakeroot/bin/; \
done && \
for lib in ${PREFIX}/lib/*.so; \
do \
strip --strip-all $lib; \
done && \
cp -r ${PREFIX}/lib /tmp/fakeroot/lib && \
cp -r ${PREFIX}/share /tmp/fakeroot/share && \
rm -rf /tmp/fakeroot/share/doc && \
rm -rf /tmp/fakeroot/share/man && \
rm -rf /tmp/fakeroot/share/Wt/resources/jPlayer && \
rm -rf /tmp/fakeroot/share/Wt/resources/themes/default && \
rm -rf /tmp/fakeroot/share/Wt/resources/themes/polished && \
rm -rf /tmp/fakeroot/share/Wt/resources/themes/bootstrap/2 && \
rm -rf /tmp/fakeroot/share/Wt/resources/themes/bootstrap/3
## Release Stage
FROM alpine:3.17 AS release
LABEL maintainer="Emeric Poupon <emeric.poupon@laposte.net>"
ARG RUNTIME_PACKAGES=" \
libssl3 \
libcrypto3 \
zlib \
boost-filesystem \
boost-program_options \
boost-system \
boost-thread \
libarchive \
libconfig++"
ARG FILESHELTER_USER=fileshelter
ARG FILESHELTER_GROUP=fileshelter
RUN apk add --no-cache --update ${RUNTIME_PACKAGES}
RUN addgroup -S ${FILESHELTER_GROUP} && \
adduser -S -H ${FILESHELTER_USER} && \
adduser ${FILESHELTER_USER} ${FILESHELTER_GROUP} && \
mkdir -p /var/fileshelter && chown -R ${FILESHELTER_USER}:${FILESHELTER_GROUP} /var/fileshelter
VOLUME /var/fileshelter
USER ${FILESHELTER_USER}:${FILESHELTER_GROUP}
COPY --from=build /tmp/fakeroot/ /usr
COPY --from=build /tmp/fakeroot/share/fileshelter/fileshelter.conf /etc/fileshelter.conf
EXPOSE 5091
ENTRYPOINT ["/usr/bin/fileshelter"]