| 1 |
# -*-Dockerfile-*- |
| 2 |
|
| 3 |
ARG DEBIAN_VERSION=trixie |
| 4 |
|
| 5 |
FROM debian:${DEBIAN_VERSION} AS builder-onedrive |
| 6 |
ARG DEBIAN_VERSION |
| 7 |
|
| 8 |
# Add backports repository and update before initial DEBIAN_FRONTEND installation |
| 9 |
RUN apt-get clean \ |
| 10 |
&& echo "deb http://deb.debian.org/debian ${DEBIAN_VERSION}-backports main" > /etc/apt/sources.list.d/debian-${DEBIAN_VERSION}-backports.list \ |
| 11 |
&& apt-get update \ |
| 12 |
&& apt-get upgrade -y \ |
| 13 |
&& apt-get update \ |
| 14 |
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential curl ca-certificates libcurl4-openssl-dev libsqlite3-dev libxml2-dev libdbus-1-dev pkg-config git ldc \ |
| 15 |
# Install|update curl from backports |
| 16 |
&& apt-get install -t ${DEBIAN_VERSION}-backports -y curl \ |
| 17 |
&& rm -rf /var/lib/apt/lists/* |
| 18 |
|
| 19 |
COPY . /usr/src/onedrive |
| 20 |
WORKDIR /usr/src/onedrive |
| 21 |
|
| 22 |
RUN ./configure --enable-debug\ |
| 23 |
&& make clean \ |
| 24 |
&& make \ |
| 25 |
&& make install |
| 26 |
|
| 27 |
FROM debian:${DEBIAN_VERSION}-slim |
| 28 |
ARG DEBIAN_VERSION |
| 29 |
|
| 30 |
# Add backports repository and update after DEBIAN_FRONTEND installation |
| 31 |
RUN apt-get clean \ |
| 32 |
&& echo "deb http://deb.debian.org/debian ${DEBIAN_VERSION}-backports main" > /etc/apt/sources.list.d/debian-${DEBIAN_VERSION}-backports.list \ |
| 33 |
&& apt-get update \ |
| 34 |
&& apt-get upgrade -y \ |
| 35 |
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libsqlite3-0 ca-certificates libphobos2-ldc-shared110 libdbus-1-3 \ |
| 36 |
# Install|update curl and libcurl4t64 from backports to get the latest version |
| 37 |
&& apt-get install -t ${DEBIAN_VERSION}-backports -y curl libcurl4t64 \ |
| 38 |
&& rm -rf /var/lib/apt/lists/* \ |
| 39 |
# Fix bug with ssl on armhf: https://serverfault.com/a/1045189 |
| 40 |
&& /usr/bin/c_rehash \ |
| 41 |
&& mkdir -p /onedrive/conf /onedrive/data |
| 42 |
|
| 43 |
# Install gosu v1.17 from trusted upstream source (built against Go 1.18.2) |
| 44 |
RUN set -eux; \ |
| 45 |
arch="$(dpkg --print-architecture)"; \ |
| 46 |
curl -fsSL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.17/gosu-${arch}"; \ |
| 47 |
chmod +x /usr/local/bin/gosu; \ |
| 48 |
gosu nobody true |
| 49 |
|
| 50 |
COPY --from=builder-onedrive /usr/local/bin/onedrive /usr/local/bin/ |
| 51 |
|
| 52 |
COPY contrib/docker/entrypoint.sh / |
| 53 |
RUN chmod +x /entrypoint.sh |
| 54 |
|
| 55 |
ENTRYPOINT ["/entrypoint.sh"] |