summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schwarz <s.schwarz@united-gameserver.de>2018-06-14 08:47:46 +0200
committerStefan Schwarz <s.schwarz@united-gameserver.de>2018-06-14 08:47:46 +0200
commit3e0de8128d7ce6037e033bd42b54e7da0ab381ad (patch)
treecfc0f395b3bd39b9616c9d821cb758fc7ddbbeea
parent5ff3696d6f7ffffa339e222b79513c91175acd5c (diff)
downloadbiboumi-3e0de8128d7ce6037e033bd42b54e7da0ab381ad.tar.gz
biboumi-3e0de8128d7ce6037e033bd42b54e7da0ab381ad.tar.bz2
biboumi-3e0de8128d7ce6037e033bd42b54e7da0ab381ad.tar.xz
biboumi-3e0de8128d7ce6037e033bd42b54e7da0ab381ad.zip
Remove build packages from docker image by using multistage Dockerfile.
-rw-r--r--docker/biboumi/alpine/Dockerfile72
1 files changed, 40 insertions, 32 deletions
diff --git a/docker/biboumi/alpine/Dockerfile b/docker/biboumi/alpine/Dockerfile
index 0b59eb7..89c7223 100644
--- a/docker/biboumi/alpine/Dockerfile
+++ b/docker/biboumi/alpine/Dockerfile
@@ -5,44 +5,52 @@
# This is the prefered way to build the release image, used by the
# end users, in production.
+FROM docker.io/alpine:latest as builder
+
+RUN apk add --no-cache --virtual .build cmake expat-dev g++ git libidn-dev \
+ make postgresql-dev python2 sqlite-dev udns-dev util-linux-dev
+
+RUN git clone https://github.com/randombit/botan.git && \
+ cd botan && \
+ ./configure.py --prefix=/usr && \
+ make -j8 && \
+ make install
+
+RUN git clone git://git.louiz.org/biboumi && \
+ mkdir ./biboumi/build && \
+ cd ./biboumi/build && \
+ cmake .. -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DWITH_BOTAN=1 \
+ -DWITH_SQLITE3=1 \
+ -DWITH_LIBIDN=1 \
+ -DWITH_POSTGRESQL=1 && \
+ make -j8 && \
+ make install
+
+# ---
+
FROM docker.io/alpine:latest
-RUN apk add --no-cache\
- g++\
- cmake\
- make\
- udns-dev\
- sqlite-dev\
- postgresql-dev\
- libuuid\
- util-linux-dev\
- expat-dev\
- libidn-dev\
- git\
- python2
-
-# Install botan
-RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && rm -rf /botan
-
-# Install biboumi
-RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./biboumi/build &&\
- cmake .. -DCMAKE_INSTALL_PREFIX=/usr\
- -DCMAKE_BUILD_TYPE=Release\
- -DWITH_BOTAN=1\
- -DWITH_SQLITE3=1\
- -DWITH_LIBIDN=1\
- -DWITH_POSTGRESQL=1\
- && make -j8 && make install && rm -rf /biboumi
-
-RUN adduser biboumi -D -h /home/biboumi
-
-RUN mkdir /var/lib/biboumi
-RUN chown -R biboumi:biboumi /var/lib/biboumi
+RUN apk add --no-cache libidn libpq libstdc++ libuuid postgresql-libs \
+ sqlite-libs udns expat ca-certificates
+
+COPY --from=builder /usr/bin/botan /usr/bin/botan
+COPY --from=builder /usr/lib/libbotan* /usr/lib/
+COPY --from=builder /usr/lib/pkgconfig/botan-2.pc /usr/lib/pkgconfig/botan-2.pc
+
+COPY --from=builder /etc/biboumi /etc/biboumi
+COPY --from=builder /usr/bin/biboumi /usr/bin/biboumi
COPY ./biboumi.cfg /etc/biboumi/biboumi.cfg
-RUN chown -R biboumi:biboumi /etc/biboumi
+
+RUN adduser biboumi -D -h /home/biboumi && \
+ mkdir /var/lib/biboumi && \
+ chown -R biboumi:biboumi /var/lib/biboumi && \
+ chown -R biboumi:biboumi /etc/biboumi
WORKDIR /home/biboumi
USER biboumi
CMD ["/usr/bin/biboumi", "/etc/biboumi/biboumi.cfg"]
+