mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-06-18 22:33:00 -04:00
Merge pull request #87 from linuxserver/universal-docker-dev
universal-docker: initial release
This commit is contained in:
+15
-7
@@ -4,16 +4,16 @@ language: shell
|
||||
|
||||
branches:
|
||||
only:
|
||||
- <baseimagename>-<modname> #replace variables, omit brackets
|
||||
- universal-docker
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
global:
|
||||
- DOCKERHUB="linuxserver/mods" #don't modify
|
||||
- BASEIMAGE="baseimagename" #replace
|
||||
- MODNAME="modname" #replace
|
||||
- DOCKERHUB="linuxserver/mods"
|
||||
- BASEIMAGE="universal"
|
||||
- MODNAME="docker"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
@@ -25,11 +25,19 @@ jobs:
|
||||
- stage: BuildImage
|
||||
if: (NOT (type IN (pull_request)))
|
||||
script:
|
||||
# Set version
|
||||
- if [ -z ${COMPOSE_TAG+x} ]; then COMPOSE_TAG=$(curl -sX GET "https://api.github.com/repos/linuxserver/docker-docker-compose/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]'); fi
|
||||
- if [ -z ${COMPOSE_ALPINE_TAG+x} ]; then COMPOSE_ALPINE_TAG=$(curl -sX GET "https://api.github.com/repos/linuxserver/docker-docker-compose/releases" | jq -r 'first(.[] | select(.prerelease==true)) | .tag_name'); fi
|
||||
- COMPOSE_VERSION=$(echo "$COMPOSE_TAG" | sed 's|-ls.*||g')
|
||||
- COMPOSE_ALPINE_VERSION="$(echo ${COMPOSE_ALPINE_TAG} | sed 's|-ls.*||g' | sed 's|alpine-||g')"
|
||||
- if [ "$COMPOSE_VERSION" != "$COMPOSE_ALPINE_VERSION" ]; then echo "ubuntu and alpine versions are different; exiting!" && travis_terminate 1; else echo "ubuntu and alpine versions are the same, continuing with build"; fi
|
||||
# Build image
|
||||
- docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
|
||||
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
|
||||
- docker build --no-cache --build-arg COMPOSE_TAG=${COMPOSE_TAG} --build-arg COMPOSE_ALPINE_TAG=${COMPOSE_ALPINE_TAG} -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} .
|
||||
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}
|
||||
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
|
||||
# Login to DockerHub
|
||||
- echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
|
||||
# Push all of the tags
|
||||
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT}
|
||||
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT}
|
||||
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}
|
||||
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
|
||||
+30
-3
@@ -1,6 +1,33 @@
|
||||
ARG COMPOSE_TAG="latest"
|
||||
ARG COMPOSE_ALPINE_TAG="alpine"
|
||||
|
||||
FROM linuxserver/docker-compose:amd64-${COMPOSE_TAG} as compose-amd64
|
||||
FROM linuxserver/docker-compose:arm32v7-${COMPOSE_TAG} as compose-arm32
|
||||
FROM linuxserver/docker-compose:arm64v8-${COMPOSE_TAG} as compose-arm64
|
||||
FROM linuxserver/docker-compose:amd64-${COMPOSE_ALPINE_TAG} as compose-alpine-amd64
|
||||
FROM linuxserver/docker-compose:arm32v7-${COMPOSE_ALPINE_TAG} as compose-alpine-arm32
|
||||
FROM linuxserver/docker-compose:arm64v8-${COMPOSE_ALPINE_TAG} as compose-alpine-arm64
|
||||
|
||||
FROM lsiobase/alpine:3.12 as buildstage
|
||||
|
||||
COPY --from=compose-amd64 /usr/local/bin/docker-compose /root-layer/docker-compose-ubuntu/docker-compose_x86_64
|
||||
COPY --from=compose-amd64 /usr/local/bin/docker /root-layer/docker-compose-ubuntu/docker_x86_64
|
||||
COPY --from=compose-arm32 /usr/local/bin/docker-compose /root-layer/docker-compose-ubuntu/docker-compose_armv7l
|
||||
COPY --from=compose-arm32 /usr/local/bin/docker /root-layer/docker-compose-ubuntu/docker_armv7l
|
||||
COPY --from=compose-arm64 /usr/local/bin/docker-compose /root-layer/docker-compose-ubuntu/docker-compose_aarch64
|
||||
COPY --from=compose-arm64 /usr/local/bin/docker /root-layer/docker-compose-ubuntu/docker_aarch64
|
||||
COPY --from=compose-alpine-amd64 /usr/local/bin/docker-compose /root-layer/docker-compose-alpine/docker-compose_x86_64
|
||||
COPY --from=compose-alpine-amd64 /usr/local/bin/docker /root-layer/docker-compose-alpine/docker_x86_64
|
||||
COPY --from=compose-alpine-arm32 /usr/local/bin/docker-compose /root-layer/docker-compose-alpine/docker-compose_armv7l
|
||||
COPY --from=compose-alpine-arm32 /usr/local/bin/docker /root-layer/docker-compose-alpine/docker_armv7l
|
||||
COPY --from=compose-alpine-arm64 /usr/local/bin/docker-compose /root-layer/docker-compose-alpine/docker-compose_aarch64
|
||||
COPY --from=compose-alpine-arm64 /usr/local/bin/docker /root-layer/docker-compose-alpine/docker_aarch64
|
||||
COPY root/ /root-layer/
|
||||
|
||||
# runtime stage
|
||||
FROM scratch
|
||||
|
||||
LABEL maintainer="username"
|
||||
LABEL maintainer="aptalca"
|
||||
|
||||
# copy local files
|
||||
COPY root/ /
|
||||
# Add files from buildstage
|
||||
COPY --from=buildstage /root-layer/ /
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
## Buildstage ##
|
||||
FROM lsiobase/alpine:3.12 as buildstage
|
||||
|
||||
RUN \
|
||||
echo "**** install packages ****" && \
|
||||
apk add --no-cache \
|
||||
curl && \
|
||||
echo "**** grab rclone ****" && \
|
||||
mkdir -p /root-layer && \
|
||||
curl -o \
|
||||
/root-layer/rclone.deb -L \
|
||||
"https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb"
|
||||
|
||||
# copy local files
|
||||
COPY root/ /root-layer/
|
||||
|
||||
## Single layer deployed image ##
|
||||
FROM scratch
|
||||
|
||||
LABEL maintainer="username"
|
||||
|
||||
# Add files from buildstage
|
||||
COPY --from=buildstage /root-layer/ /
|
||||
@@ -1,17 +1,9 @@
|
||||
# Rsync - Docker mod for openssh-server
|
||||
# Docker - Docker mod for all images
|
||||
|
||||
This mod adds rsync to openssh-server, to be installed/updated during container start.
|
||||
This mod adds `docker` and `docker-compose` binaries to any linuxserver image.
|
||||
|
||||
In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync`
|
||||
**IMPORTANT NOTE**: For docker access inside a container, a volume mapping needs to be added for `/var/run/docker.sock:/var/run/docker.sock` in the container's docker run/create/compose. If you'd like to connect to a remote docker service instead, you don't have to map the docker sock; you can either set an env var for `DOCKER_HOST=remoteaddress` or use the docker cli option `-H`.
|
||||
|
||||
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-rsync|linuxserver/mods:openssh-server-mod2`
|
||||
In the container's docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:universal-docker` to enable.
|
||||
|
||||
# Mod creation instructions
|
||||
|
||||
* Fork the repo, create a new branch based on the branch `template`.
|
||||
* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done.
|
||||
* Inspect the `root` folder contents. Edit, add and remove as necessary.
|
||||
* Edit this readme with pertinent info, delete these instructions.
|
||||
* Finally edit the `travis.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`.
|
||||
* Ask the team to create a new branch named `<baseimagename>-<modname>`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch.
|
||||
* Submit PR against the branch created by the team.
|
||||
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:universal-docker|linuxserver/mods:universal-mod2`
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
echo "**** installing docker and docker compose ****"
|
||||
if [ -f /usr/bin/apt ]; then
|
||||
DISTRONAME="ubuntu"
|
||||
else
|
||||
DISTRONAME="alpine"
|
||||
fi
|
||||
ARCH=$(uname -m)
|
||||
if [ -f "/docker-compose-${DISTRONAME}/docker-compose_${ARCH}" ] ; then
|
||||
echo "Copying over docker and docker-compose binaries"
|
||||
mv "/docker-compose-${DISTRONAME}/docker-compose_${ARCH}" /usr/local/bin/docker-compose
|
||||
mv "/docker-compose-${DISTRONAME}/docker_${ARCH}" /usr/local/bin/docker
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
rm -rf /docker-compose-ubuntu /docker-compose-alpine
|
||||
else
|
||||
echo "**** docker and docker-compose already installed, skipping ****"
|
||||
fi
|
||||
|
||||
if [ -S /var/run/docker.sock ]; then
|
||||
DOCKER_GID=$(stat -c '%g' "/var/run/docker.sock")
|
||||
if id -G abc | grep -qw "$DOCKER_GID"; then
|
||||
exit 0
|
||||
else
|
||||
DOCKER_NAME=$(getent group "${DOCKER_GID}" | awk -F: '{print $1}')
|
||||
if [ -z "${DOCKER_NAME}" ]; then
|
||||
DOCKER_NAME="dockergroup"
|
||||
groupadd -g "${DOCKER_GID}" "${DOCKER_NAME}"
|
||||
fi
|
||||
usermod -aG "${DOCKER_NAME}" abc
|
||||
fi
|
||||
elif [ -n "$DOCKER_HOST" ]; then
|
||||
echo "**** /var/run/docker.sock is not mapped, therefore, docker client will only work with a remote docker service ****"
|
||||
else
|
||||
echo "**** Please map /var/run/docker.sock for access to docker service on host. Alternatively you can manually define a remote host address with the docker cli option -H ****"
|
||||
fi
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# Determine if setup is needed
|
||||
if [ ! -f /usr/local/lib/python***/dist-packages/sshuttle ] && \
|
||||
[ -f /usr/bin/apt ]; then
|
||||
## Ubuntu
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y \
|
||||
iptables \
|
||||
openssh-client \
|
||||
python3 \
|
||||
python3-pip
|
||||
pip3 install sshuttle
|
||||
fi
|
||||
if [ ! -f /usr/lib/python***/site-packages/sshuttle ] && \
|
||||
[ -f /sbin/apk ]; then
|
||||
# Alpine
|
||||
apk add --no-cache \
|
||||
iptables \
|
||||
openssh \
|
||||
py3-pip \
|
||||
python3
|
||||
pip3 install sshuttle
|
||||
fi
|
||||
|
||||
chown -R root:root /root
|
||||
chmod -R 600 /root/.ssh
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
sshuttle --dns --remote root@${HOST}:${PORT} 0/0 -x 172.17.0.0/16
|
||||
Reference in New Issue
Block a user