optimized image layers

This commit is contained in:
Andreas Balogh
2022-07-17 19:16:02 +00:00
parent 9cd74b69ed
commit d8af5586ef
5 changed files with 80 additions and 28 deletions

9
build.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/bash
DOCKER_BUILDKIT=1 docker build -f kopano.dockerfile -t kopano .
docker container prune -f
docker create --name kopano kopano:latest
docker export kopano | docker import - kopano:squashed
# docker run -d --name kopano kopano:squashed
# docker exec -it kopano bash
# docker stop kopano
# docker rm kopano

View File

@@ -1,6 +1,6 @@
apt-get update -y apt-get update
DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
TZ=Europe/Berlin export TZ=Europe/Berlin
apt-get install -y tzdata z-push apache2 apt-get install -y tzdata z-push apache2
tar xzf core-11.0.2.50.507cbae-Ubuntu_20.04-amd64.tar.gz tar xzf core-11.0.2.50.507cbae-Ubuntu_20.04-amd64.tar.gz
tar xzf webapp-6.0.0.57.1049268-Ubuntu_20.04-all.tar.gz tar xzf webapp-6.0.0.57.1049268-Ubuntu_20.04-all.tar.gz

View File

@@ -1,2 +0,0 @@
#!/usr/bin/bash
docker build -f kopano.dockerfile -t kopano:1 .

View File

@@ -1,24 +1,47 @@
# FROM ubuntu:20.04 # syntax=docker/dockerfile:1.3-labs
FROM tozd/runit:ubuntu-focal FROM ubuntu:20.04
# build s6 process manager # install apt packages
# build postfix RUN <<EOF
# build postgres apt-get update -y
# build apache export DEBIAN_FRONTEND=noninteractive
# build z-push export TZ=Europe/Berlin
# build kopano apt-get install -y tzdata z-push apache2 postfix spampd wget xz-utils
WORKDIR /root apt-get autoclean
COPY dist/core-11.0.2.50.507cbae-Ubuntu_20.04-amd64.tar.gz . EOF
COPY dist/webapp-6.0.0.57.1049268-Ubuntu_20.04-all.tar.gz . # install s6 process manager
COPY deploy-kopano.sh . ADD https://github.com/just-containers/s6-overlay/releases/download/v3.1.1.2/s6-overlay-noarch.tar.xz /tmp
RUN ./deploy-kopano.sh ADD https://github.com/just-containers/s6-overlay/releases/download/v3.1.1.2/s6-overlay-x86_64.tar.xz /tmp
COPY service /etc/service RUN <<EOF
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
EOF
COPY ./etc/s6-overlay /etc/s6-overlay
# install kopano core
RUN <<EOF
wget --no-verbose -P/tmp http://bldr/core-11.0.2.50.507cbae-Ubuntu_20.04-amd64.tar.gz
tar xzf /tmp/core-11.0.2.50.507cbae-Ubuntu_20.04-amd64.tar.gz
for F in ~/core-11.0.2.50.507cbae-Ubuntu_20.04-amd64/*.deb; do dpkg --unpack --no-triggers $F; done
apt-get install -f -y
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache ~/.npm
rm -rf ~/core-11.0.2.50.507cbae-Ubuntu_20.04-amd64
EOF
# install kopano webapp
RUN <<EOF
wget --no-verbose -P/tmp http://bldr/webapp-6.0.0.57.1049268-Ubuntu_20.04-all.tar.gz
tar xzf /tmp/webapp-6.0.0.57.1049268-Ubuntu_20.04-all.tar.gz
for F in ~/webapp-6.0.0.57.1049268-Ubuntu_20.04-all/*.deb; do dpkg --unpack --no-triggers $F; done
apt-get install -f -y
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache ~/.npm
rm -rf ~/webapp-6.0.0.57.1049268-Ubuntu_20.04-all
EOF
# https://documentation.kopano.io/kopanocore_administrator_manual/configure_kc_components.html#configure-kopano-dagent-for-delivery-via-unix-socket # https://documentation.kopano.io/kopanocore_administrator_manual/configure_kc_components.html#configure-kopano-dagent-for-delivery-via-unix-socket
# declaration section WORKDIR /root
ARG MAIL_DOMAIN=zntrl.de EXPOSE 80
EXPOSE 80 443
EXPOSE 2003
EXPOSE 993 EXPOSE 993
EXPOSE 2003
EXPOSE 8443 EXPOSE 8443
# create run scripts in etc/service VOLUME /var/lib/kopano/attachments
# CMD ["/usr/sbin/kopano-server", "-F", "-c", "/etc/kopano/server.cfg"] VOLUME /var/lib/z-push
ENTRYPOINT ["init.sh"] ENTRYPOINT ["/init"]

22
mysql/docker-compose.yml Normal file
View File

@@ -0,0 +1,22 @@
version: '3.1'
services:
db:
image: mysql:latest
container_name: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: Asdf2345
ports:
- 3307:3306
networks:
- kopano
volumes:
- ~/kopano/mysql/etc:/etc/mysql
- database:/var/lib/mysql
secrets:
db_root_password:
file: db_root_password.txt
networks:
- kopano
volumes:
- database: