* Rework PR #1733 pulling in dockerfile changes + updating documentation
* Drop GitHub Docker actions yaml
This commit is contained in:
abraunegg 2022-01-14 11:30:01 +11:00
parent c30fa4b681
commit caacf87253
7 changed files with 128 additions and 112 deletions

View file

@ -1,26 +1,38 @@
FROM centos:7
ENV GOSU_VERSION=1.11
# -*-Dockerfile-*-
ARG FEDORA_VERSION=35
ARG DEBIAN_VERSION=bullseye
ARG GO_VERSION=1.17
ARG GOSU_VERSION=1.14
FROM golang:${GO_VERSION}-${DEBIAN_VERSION} AS builder-gosu
ARG GOSU_VERSION
RUN go install -ldflags "-s -w" github.com/tianon/gosu@${GOSU_VERSION}
FROM fedora:${FEDORA_VERSION} AS builder-onedrive
RUN dnf install -y ldc pkgconf libcurl-devel sqlite-devel
ENV PKG_CONFIG=/usr/bin/pkgconf
RUN yum install -y make git gcc libcurl-devel sqlite-devel pkg-config && \
yum install -y http://downloads.dlang.org/releases/2.x/2.097.0/dmd-2.097.0-0.fedora.x86_64.rpm && \
rm -rf /var/cache/yum/ && \
# gosu installation
gpg --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& rm -r /root/.gnupg/ \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
RUN mkdir -p /onedrive/conf /onedrive/data
COPY . /usr/src/onedrive
WORKDIR /usr/src/onedrive
RUN ./configure && \
make clean && \
make && \
make install
COPY contrib/docker/entrypoint.sh /entrypoint.sh
VOLUME ["/onedrive/conf"]
RUN ./configure \
&& make clean \
&& make \
&& make install
FROM fedora:${FEDORA_VERSION}
RUN dnf install -y libcurl sqlite ldc-libs \
&& dnf clean all \
&& mkdir -p /onedrive/conf /onedrive/data
COPY --from=builder-gosu /go/bin/gosu /usr/local/bin/
COPY --from=builder-onedrive /usr/local/bin/onedrive /usr/local/bin/
COPY contrib/docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -1,21 +0,0 @@
# -*-Dockerfile-*-
FROM debian:stretch
RUN apt update && \
apt install -y build-essential curl libcurl4-openssl-dev libsqlite3-dev pkg-config wget git
RUN wget https://github.com/ldc-developers/ldc/releases/download/v1.17.0/ldc2-1.17.0-linux-aarch64.tar.xz && \
tar -xvf ldc2-1.17.0-linux-aarch64.tar.xz
COPY . /usr/src/onedrive
RUN cd /usr/src/onedrive/ && \
./configure DC=/ldc2-1.17.0-linux-aarch64/bin/ldmd2 && \
make clean && \
make && \
make install
FROM debian:stretch-slim
ENTRYPOINT ["/entrypoint.sh"]
RUN apt update && \
apt install -y gosu libcurl3 libsqlite3-0 && \
rm -rf /var/*/apt && \
mkdir -p /onedrive/conf /onedrive/data
COPY contrib/docker/entrypoint.sh /
COPY --from=0 /usr/local/bin/onedrive /usr/local/bin/

View file

@ -1,21 +1,35 @@
# -*-Dockerfile-*-
FROM alpine:3.14
RUN apk add \
alpine-sdk gnupg xz curl-dev sqlite-dev binutils-gold \
autoconf automake ldc go
RUN go get github.com/tianon/gosu
COPY . /usr/src/onedrive
RUN cd /usr/src/onedrive/ && \
autoreconf -fiv && \
./configure && \
make clean && \
make && \
make install
FROM alpine:3.14
ENTRYPOINT ["/entrypoint.sh"]
RUN apk add --no-cache \
bash libcurl libgcc shadow sqlite-libs ldc-runtime && \
mkdir -p /onedrive/conf /onedrive/data
ARG ALPINE_VERSION=3.15
ARG GO_VERSION=1.17
ARG GOSU_VERSION=1.14
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder-gosu
ARG GOSU_VERSION
RUN go install -ldflags "-s -w" github.com/tianon/gosu@${GOSU_VERSION}
FROM alpine:${ALPINE_VERSION} AS builder-onedrive
RUN apk add --update --no-cache alpine-sdk gnupg xz curl-dev sqlite-dev binutils-gold autoconf automake ldc
COPY . /usr/src/onedrive
WORKDIR /usr/src/onedrive
RUN autoreconf -fiv \
&& ./configure \
&& make clean \
&& make \
&& make install
FROM alpine:${ALPINE_VERSION}
RUN apk add --update --no-cache bash libcurl libgcc shadow sqlite-libs ldc-runtime \
&& mkdir -p /onedrive/conf /onedrive/data
COPY --from=builder-gosu /go/bin/gosu /usr/local/bin/
COPY --from=builder-onedrive /usr/local/bin/onedrive /usr/local/bin/
COPY contrib/docker/entrypoint.sh /
COPY --from=0 /root/go/bin/gosu /usr/local/bin/onedrive /usr/local/bin/
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -0,0 +1,55 @@
# -*-Dockerfile-*-
ARG DEBIAN_VERSION=buster
ARG LDC_VERSION=1.17.0
FROM debian:${DEBIAN_VERSION} AS builder-onedrive
ARG LDC_VERSION
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential curl ca-certificates libcurl4-openssl-dev libsqlite3-dev libxml2-dev pkg-config \
&& rm -rf /var/lib/apt/lists/*
RUN ARCH="$(dpkg --print-architecture)" \
&& case "${ARCH}" in \
aarch64|arm64) \
BINARY_URL="https://github.com/ldc-developers/ldc/releases/download/v${LDC_VERSION}/ldc2-${LDC_VERSION}-linux-aarch64.tar.xz"; \
;; \
armhf|arm) \
BINARY_URL="https://github.com/ldc-developers/ldc/releases/download/v${LDC_VERSION}/ldc2-${LDC_VERSION}-linux-armhf.tar.xz"; \
;; \
amd64|x86-64) \
BINARY_URL="https://github.com/ldc-developers/ldc/releases/download/v${LDC_VERSION}/ldc2-${LDC_VERSION}-linux-x86_64.tar.xz"; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac \
&& echo ${BINARY_URL} \
&& curl -k -LfsSo /tmp/ldc.tar.xz ${BINARY_URL} \
&& mkdir -p /opt/ldc \
&& tar -xvf /tmp/ldc.tar.xz -C /opt/ldc --strip-components=1 \
&& rm -rf /tmp/ldc.tar.xz
COPY . /usr/src/onedrive
WORKDIR /usr/src/onedrive
RUN ./configure DC=/opt/ldc/bin/ldmd2 \
&& make clean \
&& make \
&& make install
FROM debian:${DEBIAN_VERSION}-slim
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gosu libcurl4 libsqlite3-0 ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /onedrive/conf /onedrive/data
COPY --from=builder-onedrive /usr/local/bin/onedrive /usr/local/bin/
COPY contrib/docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -1,21 +0,0 @@
# -*-Dockerfile-*-
FROM debian:stretch
RUN apt update && \
apt install -y build-essential curl libcurl4-openssl-dev libsqlite3-dev pkg-config wget git
RUN wget https://github.com/ldc-developers/ldc/releases/download/v1.17.0/ldc2-1.17.0-linux-armhf.tar.xz && \
tar -xvf ldc2-1.17.0-linux-armhf.tar.xz
COPY . /usr/src/onedrive
RUN cd /usr/src/onedrive/ && \
./configure DC=/ldc2-1.17.0-linux-armhf/bin/ldmd2 && \
make clean && \
make && \
make install
FROM debian:stretch-slim
ENTRYPOINT ["/entrypoint.sh"]
RUN apt update && \
apt install -y gosu libcurl3 libsqlite3-0 && \
rm -rf /var/*/apt && \
mkdir -p /onedrive/conf /onedrive/data
COPY contrib/docker/entrypoint.sh /
COPY --from=0 /usr/local/bin/onedrive /usr/local/bin/

View file

@ -1,23 +0,0 @@
# -*-Dockerfile-*-
FROM debian:stretch
RUN apt update && \
apt install -y build-essential curl libcurl4-openssl-dev libsqlite3-dev pkg-config git wget
RUN wget http://downloads.dlang.org/releases/2.x/2.097.0/dmd_2.097.0-0_amd64.deb -O /tmp/dmd_amd64.deb && \
dpkg -i /tmp/dmd_amd64.deb
RUN rm -f /tmp/dmd_amd64.deb
COPY . /usr/src/onedrive
RUN cd /usr/src/onedrive/ && \
./configure && \
make clean && \
make && \
make install
FROM debian:stretch-slim
ENTRYPOINT ["/entrypoint.sh"]
RUN apt update && \
apt install -y gosu libcurl3 libsqlite3-0 && \
rm -rf /var/*/apt && \
mkdir -p /onedrive/conf /onedrive/data
COPY contrib/docker/entrypoint.sh /
COPY --from=0 /usr/local/bin/onedrive /usr/local/bin/

View file

@ -1,7 +1,7 @@
# Run the OneDrive Client for Linux under Docker
This client can be run as a Docker container, with 3 available options for you to choose from:
1. Container based on CentOS 7 - Docker Tag: latest
2. Container based on Debian Stretch - Docker Tag: stretch
1. Container based on Fedora 35 - Docker Tag: latest
2. Container based on Debian Buster - Docker Tag: buster
3. Container based on Alpine Linux - Docker Tag: alpine
These containers offer a simple monitoring-mode service for the OneDrive Client for Linux.
@ -251,14 +251,14 @@ docker build . -t local-onedrive -f contrib/docker/Dockerfile
```
There are alternate, smaller images available by building
Dockerfile-stretch or Dockerfile-alpine. These [multi-stage builder
Dockerfile-debian or Dockerfile-alpine. These [multi-stage builder
pattern](https://docs.docker.com/develop/develop-images/multistage-build/)
Dockerfiles require Docker version at least 17.05.
#### How to build and run a custom Docker image based on Debian Stretch
#### How to build and run a custom Docker image based on Debian Buster
``` bash
docker build . -t local-ondrive-stretch -f contrib/docker/Dockerfile-stretch
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-ondrive-stretch:latest
docker build . -t local-ondrive-stretch -f contrib/docker/Dockerfile-debian
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-ondrive-debian:latest
```
#### How to build and run a custom Docker image based on Alpine Linux
@ -275,12 +275,12 @@ Compatible with:
* Raspberry Pi 3
* Raspberry Pi 4
``` bash
docker build . -t local-onedrive-rpi -f contrib/docker/Dockerfile-rpi
docker build . -t local-onedrive-rpi -f contrib/docker/Dockerfile-debian
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-ondrive-rpi:latest
```
#### How to build and run a custom Docker image for AARCH64 Platforms
``` bash
docker build . -t local-onedrive-aarch64 -f contrib/docker/Dockerfile-aarch64
docker build . -t local-onedrive-aarch64 -f contrib/docker/Dockerfile-debian
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-onedrive-aarch64:latest
```