Optimising build

pull/60/head
Alex 2022-08-13 16:55:43 +01:00 zatwierdzone przez modem7
rodzic d8dde7cc65
commit 4998a35fbf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 780D7218B8D553A3
4 zmienionych plików z 35 dodań i 72 usunięć

Wyświetl plik

@ -25,9 +25,7 @@ steps:
compress: true
use_cache: true
build_args: BUILDKIT_INLINE_CACHE=1
cache_from:
- ${DRONE_REPO}:latest
- alpine:latest
cache_from: ${DRONE_REPO}:latest
Dockerfile: base-fullbuild/Dockerfile
context: base-fullbuild/
platforms: # if it doesn't work run docker run --privileged --rm tonistiigi/binfmt --install all

Wyświetl plik

@ -1,7 +1,7 @@
# syntax = docker/dockerfile:latest
FROM modem7/borgmatic-docker:latest
COPY --chmod=755 entry.sh /entry.sh
COPY --chmod=755 --link entry.sh /
RUN apk add --update --no-cache \
docker-cli
CMD ["/entry.sh"]

97
base-fullbuild/Dockerfile 100644 → 100755
Wyświetl plik

@ -1,37 +1,7 @@
# syntax = docker/dockerfile:latest
FROM alpine:3.16.2 as builder
FROM python:3.10.5-alpine3.16
LABEL mainainer='modem7'
COPY requirements.txt /requirements.txt
# mostly taken from https://github.com/borgbackup/borg/blob/1.1.15/Vagrantfile#L10-L26
RUN apk update && apk add --update --no-cache \
alpine-sdk \
linux-headers \
py3-pkgconfig \
py3-wheel \
py3-xxhash \
py3-setuptools \
py3-pip \
python3-dev \
openssl-dev \
lz4-dev \
acl-dev \
fuse-dev \
attr-dev \
zlib-dev \
bzip2-dev \
ncurses-dev \
readline-dev \
xz-dev \
sqlite-dev \
libffi-dev \
&& python3 -m pip install --no-cache-dir -U pip setuptools wheel
RUN python3 -m pip install -v --no-cache-dir -U -r requirements.txt
FROM alpine:3.16.2
LABEL mainainer='modem7'
ARG PYTHON_VERSION=3.10
VOLUME /mnt/source
VOLUME /mnt/borg-repository
VOLUME /root/.borgmatic
@ -40,39 +10,34 @@ VOLUME /root/.config/borg
VOLUME /root/.ssh
VOLUME /root/.cache/borg
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 CMD borgmatic --version || exit 1
RUN apk add --update --no-cache \
tzdata \
sshfs \
python3 \
openssl \
fuse \
ca-certificates \
logrotate \
lz4-libs \
libacl \
postgresql-client \
mariadb-client \
mongodb-tools \
curl \
findmnt \
bash \
bash-completion \
bash-doc \
&& rm -rf \
/var/cache/apk/* \
/.cache
COPY --link --from=builder /usr/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/
COPY --link --chmod=755 --from=builder \
/usr/bin/borg \
/usr/bin/borgfs \
/usr/bin/borgmatic \
/usr/bin/generate-borgmatic-config \
/usr/bin/upgrade-borgmatic-config \
/usr/bin/validate-borgmatic-config \
/usr/bin/markdown_py \
/usr/bin/normalizer \
/usr/bin/apprise \
/usr/bin/
COPY --chmod=755 entry.sh /entry.sh
RUN borgmatic --bash-completion > /usr/share/bash-completion/completions/borgmatic && echo "source /etc/profile.d/bash_completion.sh" > /root/.bashrc
RUN <<EOF
set -x
apk add -U --no-cache \
tzdata \
sshfs \
openssl \
fuse \
ca-certificates \
logrotate \
lz4-libs \
libacl \
postgresql-client \
mariadb-client \
mongodb-tools \
curl \
findmnt \
bash \
bash-completion \
bash-doc
EOF
COPY --chmod=755 --link entry.sh /
COPY --link requirements.txt /
RUN python3 -m pip install --no-cache -Ur requirements.txt
RUN <<EOF
set -x
borgmatic --bash-completion > /usr/share/bash-completion/completions/borgmatic
echo "source /etc/profile.d/bash_completion.sh" > /root/.bashrc
EOF
CMD ["/entry.sh"]

Wyświetl plik

@ -1,6 +1,6 @@
# syntax = docker/dockerfile:latest
FROM modem7/borgmatic-docker:latest
COPY --chmod=755 entry.sh /entry.sh
COPY --chmod=755 wtfc.sh /wtfc.sh
COPY --chmod=755 --link entry.sh /
COPY --chmod=755 --link wtfc.sh /
CMD ["/entry.sh"]