switch to v2 and deprecate

This commit is contained in:
aptalca 2022-04-08 13:17:38 -04:00
parent aa1f0e8b05
commit 065141f972
4 changed files with 131 additions and 29 deletions

View File

@ -16,22 +16,25 @@ jobs:
- name: Build image
run: |
# 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
COMPOSE_VERSION=$(echo "$COMPOSE_TAG" | sed 's|-ls.*||g')
echo "COMPOSE_VERSION=${COMPOSE_VERSION}" >> $GITHUB_ENV
if [ -z ${COMPOSE_RELEASE+x} ]; then COMPOSE_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); fi
if [ -z ${DOCKER_RELEASE+x} ]; then DOCKER_RELEASE=$(curl -sX GET "https://api.github.com/repos/moby/moby/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); fi
COMBINED_VERSION=${DOCKER_RELEASE}-${COMPOSE_RELEASE}
echo "**** Combined version is ${COMBINED_VERSION} ****"
echo "COMBINED_VERSION=${COMBINED_VERSION}" >> $GITHUB_ENV
if curl -fSsL "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_RELEASE}.tgz" >/dev/null && curl -fSsL "https://download.docker.com/linux/static/stable/armhf/docker-${DOCKER_RELEASE}.tgz" >/dev/null && curl -fSsL "https://download.docker.com/linux/static/stable/aarch64/docker-${DOCKER_RELEASE}.tgz" >/dev/null; then echo "Docker tarballs exist, proceeding"; else echo "Docker tarballs are missing, exiting!" && exit 1; fi
# Build image
docker build --no-cache --build-arg COMPOSE_TAG=${COMPOSE_TAG} -t ${{ github.sha }} .
docker build --no-cache --build-arg COMPOSE_RELEASE=${COMPOSE_RELEASE} --build-arg DOCKER_RELEASE=${DOCKER_RELEASE} -t ${{ github.sha }} .
- name: Tag image
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
run: |
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}-${{ github.sha }}
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}-${{ github.sha }}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
- name: Credential check
@ -56,8 +59,8 @@ jobs:
- name: Push tags to GitHub Container Registry
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
run: |
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}-${{ github.sha }}
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
@ -69,7 +72,7 @@ jobs:
- name: Push tags to DockerHub
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
run: |
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMPOSE_VERSION }}-${{ github.sha }}
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}

View File

@ -1,17 +1,89 @@
ARG COMPOSE_TAG="latest"
FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as buildstage
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
ARG DOCKER_RELEASE
ARG COMPOSE_RELEASE
FROM lsiobase/alpine:3.11 as buildstage
RUN \
echo "**** install packages ****" && \
apk add --no-cache \
curl \
git \
go && \
echo "**** retrieve latest docker version ****" && \
if [ -z ${DOCKER_RELEASE+x} ]; then \
DOCKER_RELEASE=$(curl -sX GET "https://api.github.com/repos/moby/moby/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]' \
| sed 's|^v||'); \
fi && \
echo "**** grab docker ****" && \
mkdir -p \
/root-layer/docker-bins \
/tmp/docker_x86_64 \
/tmp/docker_armv7l \
/tmp/docker_aarch64 && \
curl -fo \
/tmp/docker_x86_64.tgz -L \
"https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_RELEASE}.tgz" && \
tar xf \
/tmp/docker_x86_64.tgz -C \
/tmp/docker_x86_64 --strip-components=1 && \
cp /tmp/docker_x86_64/docker /root-layer/docker-bins/docker_x86_64 && \
curl -fo \
/tmp/docker_armv7l.tgz -L \
"https://download.docker.com/linux/static/stable/armhf/docker-${DOCKER_RELEASE}.tgz" && \
tar xf \
/tmp/docker_armv7l.tgz -C \
/tmp/docker_armv7l --strip-components=1 && \
cp /tmp/docker_armv7l/docker /root-layer/docker-bins/docker_armv7l && \
curl -fo \
/tmp/docker_aarch64.tgz -L \
"https://download.docker.com/linux/static/stable/aarch64/docker-${DOCKER_RELEASE}.tgz" && \
tar xf \
/tmp/docker_aarch64.tgz -C \
/tmp/docker_aarch64 --strip-components=1 && \
cp /tmp/docker_aarch64/docker /root-layer/docker-bins/docker_aarch64 && \
echo "**** retrieve latest compose version ****" && \
if [ -z ${COMPOSE_RELEASE+x} ]; then \
COMPOSE_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]' \
| sed 's|^v||'); \
fi && \
echo "**** grab compose ****" && \
curl -fo \
/root-layer/docker-bins/docker-compose_x86_64 -L \
"https://github.com/docker/compose/releases/download/v${COMPOSE_RELEASE}/docker-compose-linux-x86_64" && \
curl -fo \
/root-layer/docker-bins/docker-compose_armv7l -L \
"https://github.com/docker/compose/releases/download/v${COMPOSE_RELEASE}/docker-compose-linux-armv7" && \
curl -fo \
/root-layer/docker-bins/docker-compose_aarch64 -L \
"https://github.com/docker/compose/releases/download/v${COMPOSE_RELEASE}/docker-compose-linux-aarch64" && \
echo "**** retrieve latest compose switch version ****" && \
if [ -z ${SWITCH_RELEASE+x} ]; then \
SWITCH_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose-switch/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]' \
| sed 's|^v||'); \
fi && \
echo "**** grab compose switch ****" && \
curl -fo \
/root-layer/docker-bins/compose-switch_x86_64 -L \
"https://github.com/docker/compose-switch/releases/download/v${SWITCH_RELEASE}/docker-compose-linux-amd64" && \
curl -fo \
/root-layer/docker-bins/compose-switch_aarch64 -L \
"https://github.com/docker/compose-switch/releases/download/v${SWITCH_RELEASE}/docker-compose-linux-arm64" && \
echo "**** compile compose switch on armhf ****" && \
curl -fo \
/tmp/compose-switch.tar.gz -L \
"https://github.com/docker/compose-switch/archive/refs/tags/v${SWITCH_RELEASE}.tar.gz" && \
mkdir -p /tmp/compose-switch && \
tar xf \
/tmp/compose-switch.tar.gz -C \
/tmp/compose-switch --strip-components=1 && \
cd /tmp/compose-switch && \
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags="-s -w -X github.com/docker/compose-switch/internal.Version=${SWITCH_RELEASE}" -o /root-layer/docker-bins/compose-switch_armv7l ./main.go && \
chmod +x /root-layer/docker-bins/* && \
rm -rf /tmp/*
COPY --from=compose-amd64 /usr/local/bin/docker-compose /root-layer/docker-compose/docker-compose_x86_64
COPY --from=compose-amd64 /usr/local/bin/docker /root-layer/docker-compose/docker_x86_64
COPY --from=compose-arm32 /usr/local/bin/docker-compose /root-layer/docker-compose/docker-compose_armv7l
COPY --from=compose-arm32 /usr/local/bin/docker /root-layer/docker-compose/docker_armv7l
COPY --from=compose-arm64 /usr/local/bin/docker-compose /root-layer/docker-compose/docker-compose_aarch64
COPY --from=compose-arm64 /usr/local/bin/docker /root-layer/docker-compose/docker_aarch64
COPY root/ /root-layer/
# runtime stage

View File

@ -1,3 +1,9 @@
# **DEPRECATED**
This mod has been deprecated and will not receive future updates. Please use the universal version instead:
`linuxserver/mods:universal-docker`
# Docker - Docker mod for code-server
This mod adds docker and docker-compose binaries to code-server.

View File

@ -2,16 +2,37 @@
echo "**** installing docker and docker compose ****"
ARCH=$(uname -m)
if [ -f "/docker-compose/docker-compose_${ARCH}" ]; then
if [ -d "/docker-bins" ] ; then
echo "Copying over docker and docker-compose binaries"
mv "/docker-compose/docker-compose_${ARCH}" /usr/local/bin/docker-compose
mv "/docker-compose/docker_${ARCH}" /usr/local/bin/docker
chmod +x /usr/local/bin/docker-compose
rm -rf /docker-compose
mkdir -p /usr/local/lib/docker/cli-plugins
mv "/docker-bins/docker-compose_${ARCH}" /usr/local/lib/docker/cli-plugins/docker-compose
mv "/docker-bins/docker_${ARCH}" /usr/local/bin/docker
mv "/docker-bins/compose-switch_${ARCH}" /usr/local/bin/docker-compose
rm -rf /docker-bins
else
echo "**** docker and docker-compose already installed, skipping ****"
fi
echo '
***********************************************************
***********************************************************
**** ****
**** ****
**** This mod "linuxserver/mods:code-server-docker" ****
**** ****
**** ****
**** has been deprecated and will not receive updates ****
**** ****
**** ****
**** Please switch to the universal version: ****
**** ****
**** "linuxserver/mods:universal-docker" ****
**** ****
**** ****
***********************************************************
***********************************************************'
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
@ -25,7 +46,7 @@ if [ -S /var/run/docker.sock ]; then
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 ****"
echo "**** Remote docker service $DOCKER_HOST will be used ****"
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