Last active
January 10, 2020 09:28
-
-
Save bpaquet/ce47d8a57925354be9c88eaeb70fb1f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG VERSION | |
FROM debian:${VERSION} as prebuilder | |
RUN cp -r /var /c | |
FROM debian:${VERSION} as prebuilder2 | |
RUN cp -r /usr /d | |
FROM debian:${VERSION} as prebuilder3 | |
RUN cp -r /usr /e | |
FROM debian:${VERSION} as prebuilder4 | |
RUN cp -r /usr /f | |
FROM debian:${VERSION} as builder | |
COPY --from=prebuilder /c /c | |
COPY --from=prebuilder2 /d /d | |
RUN env | |
RUN env | |
RUN env | |
RUN env | |
RUN env | |
RUN env | |
RUN env | |
RUN env | |
RUN env | |
RUN env | |
COPY Dockerfile . | |
RUN env | |
RUN cp -r /etc /a | |
RUN cp -r /etc /b | |
RUN env | |
FROM debian:${VERSION} | |
COPY --from=prebuilder3 /e /e | |
COPY --from=prebuilder4 /f /f | |
COPY --from=builder /a /a | |
COPY --from=builder /b /b | |
RUN env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get remove -y docker docker-engine docker.io containerd runc | |
sudo apt-get update | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo apt-key fingerprint 0EBFCD88 | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get update | |
sudo apt-get install -y docker-registry | |
sudo usermod -G docker ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target=$1 | |
rsync -avh $(pwd)/ ubuntu@$target:test/ | |
ssh ubuntu@$target test/test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
export DOCKER_BUILDKIT=1 | |
cd $(dirname $0) | |
sudo apt-get remove -y --purge docker-ce docker-ce-cli containerd.io || true | |
sudo rm -rf /var/lib/docker | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=2 --build-arg BUILDKIT_INLINE_CACHE=1 --target=prebuilder -t localhost:5000/cache:prebuilder . | |
docker push localhost:5000/cache:prebuilder | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=2 --build-arg BUILDKIT_INLINE_CACHE=1 --target=prebuilder2 -t localhost:5000/cache:prebuilder2 . | |
docker push localhost:5000/cache:prebuilder2 | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=2 --build-arg BUILDKIT_INLINE_CACHE=1 --target=prebuilder3 -t localhost:5000/cache:prebuilder3 . | |
docker push localhost:5000/cache:prebuilder3 | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=2 --build-arg BUILDKIT_INLINE_CACHE=1 --target=prebuilder4 -t localhost:5000/cache:prebuilder4 . | |
docker push localhost:5000/cache:prebuilder4 | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=2 --build-arg BUILDKIT_INLINE_CACHE=1 --target=builder -t localhost:5000/cache:builder . | |
docker push localhost:5000/cache:builder | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=2 --build-arg BUILDKIT_INLINE_CACHE=1 -t localhost:5000/cache:main . | |
docker push localhost:5000/cache:main | |
sudo apt-get remove -y --purge docker-ce docker-ce-cli containerd.io || true | |
sudo rm -rf /var/lib/docker | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io | |
docker pull localhost:5000/cache:prebuilder | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=3 --build-arg BUILDKIT_INLINE_CACHE=1 . --target=prebuilder --cache-from=localhost:5000/cache:prebuilder | |
docker pull localhost:5000/cache:prebuilder2 | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=3 --build-arg BUILDKIT_INLINE_CACHE=1 . --target=prebuilder2 --cache-from=localhost:5000/cache:prebuilder2 | |
docker pull localhost:5000/cache:prebuilder3 | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=3 --build-arg BUILDKIT_INLINE_CACHE=1 . --target=prebuilder3 --cache-from=localhost:5000/cache:prebuilder3 | |
docker pull localhost:5000/cache:prebuilder4 | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=3 --build-arg BUILDKIT_INLINE_CACHE=1 . --target=prebuilder3 --cache-from=localhost:5000/cache:prebuilder4 | |
docker pull localhost:5000/cache:builder | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=3 --build-arg BUILDKIT_INLINE_CACHE=1 . --target=builder --cache-from=localhost:5000/cache:prebuilder,localhost:5000/cache:prebuilder2,localhost:5000/cache:builder | |
docker pull localhost:5000/cache:main | |
docker build --build-arg VERSION=stretch-slim --build-arg bar=1 --build-arg foo=3 --build-arg BUILDKIT_INLINE_CACHE=1 . --cache-from=localhost:5000/cache:prebuilder,localhost:5000/cache:prebuilder2,localhost:5000/cache:prebuilder3,localhost:5000/cache:prebuilder4,localhost:5000/cache:builder,localhost:5000/cache:main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment