diff --git a/docker/prod/Dockerfile.amd64 b/docker/prod/Dockerfile.amd64 deleted file mode 100644 index f0f283e..0000000 --- a/docker/prod/Dockerfile.amd64 +++ /dev/null @@ -1,74 +0,0 @@ -FROM rustembedded/cross:x86_64-unknown-linux-musl AS x86_64-builder - -ARG UID=991 -ARG GID=991 - -ENV TOOLCHAIN=stable -ENV TARGET=x86_64-unknown-linux-musl -ENV TOOL=x86_64-linux-musl - -RUN \ - apt-get update && \ - apt-get upgrade -y - -RUN \ - addgroup --gid "${GID}" build && \ - adduser \ - --disabled-password \ - --gecos "" \ - --ingroup build \ - --uid "${UID}" \ - --home /opt/build \ - build - -ADD https://sh.rustup.rs /opt/build/rustup.sh - -RUN \ - chown -R build:build /opt/build - -USER build -WORKDIR /opt/build - -ENV PATH=/opt/build/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -RUN \ - chmod +x rustup.sh && \ - ./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \ - rustup target add $TARGET - -FROM x86_64-builder as builder - -ARG TAG=main -ARG REPOSITORY=https://git.asonix.dog/asonix/warriors-names -ARG BINARY=warriors-names - -RUN \ - git clone -b $TAG $REPOSITORY repo - -WORKDIR /opt/build/repo - -RUN \ - cargo build --release --target $TARGET && \ - $TOOL-strip target/$TARGET/release/$BINARY - -FROM amd64/alpine:3.11 - -ARG UID=991 -ARG GID=991 -ARG BINARY=warriors-names - -COPY --from=builder /opt/build/repo/target/x86_64-unknown-linux-musl/release/$BINARY /usr/bin/$BINARY - -RUN \ - apk add tini && \ - addgroup -g $GID warriors && \ - adduser -D -G warriors -u $UID -g "" -h /opt/warriors warriors - -RUN \ - chown -R warriors:warriors /mnt - -VOLUME /mnt -WORKDIR /opt/warriors -USER warriors -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/usr/bin/warriors-names"] diff --git a/docker/prod/Dockerfile.arm32v7 b/docker/prod/Dockerfile.arm32v7 deleted file mode 100644 index daa593a..0000000 --- a/docker/prod/Dockerfile.arm32v7 +++ /dev/null @@ -1,74 +0,0 @@ -FROM rustembedded/cross:arm-unknown-linux-musleabihf AS arm32v7-builder - -ARG UID=991 -ARG GID=991 - -ENV TOOLCHAIN=stable -ENV TARGET=arm-unknown-linux-musleabihf -ENV TOOL=arm-linux-musleabihf - -RUN \ - apt-get update && \ - apt-get upgrade -y - -RUN \ - addgroup --gid "${GID}" build && \ - adduser \ - --disabled-password \ - --gecos "" \ - --ingroup build \ - --uid "${UID}" \ - --home /opt/build \ - build - -ADD https://sh.rustup.rs /opt/build/rustup.sh - -RUN \ - chown -R build:build /opt/build - -USER build -WORKDIR /opt/build - -ENV PATH=/opt/build/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -RUN \ - chmod +x rustup.sh && \ - ./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \ - rustup target add $TARGET - -FROM arm32v7-builder as builder - -ARG TAG=main -ARG REPOSITORY=https://git.asonix.dog/asonix/warriors-names -ARG BINARY=warriors-names - -RUN \ - git clone -b $TAG $REPOSITORY repo - -WORKDIR /opt/build/repo - -RUN \ - cargo build --release --target $TARGET && \ - $TOOL-strip target/$TARGET/release/$BINARY - -FROM arm32v7/alpine:3.11 - -ARG UID=991 -ARG GID=991 -ARG BINARY=warriors-names - -COPY --from=builder /opt/build/repo/target/arm-unknown-linux-musleabihf/release/$BINARY /usr/bin/$BINARY - -RUN \ - apk add tini && \ - addgroup -g $GID warriors && \ - adduser -D -G warriors -u $UID -g "" -h /opt/warriors warriors - -RUN \ - chown -R warriors:warriors /mnt - -VOLUME /mnt -WORKDIR /opt/warriors -USER warriors -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/usr/bin/warriors-names"] diff --git a/docker/prod/Dockerfile.arm64v8 b/docker/prod/Dockerfile.arm64v8 deleted file mode 100644 index 4fbb6d9..0000000 --- a/docker/prod/Dockerfile.arm64v8 +++ /dev/null @@ -1,74 +0,0 @@ -FROM rustembedded/cross:aarch64-unknown-linux-musl AS aarch64-builder - -ARG UID=991 -ARG GID=991 - -ENV TOOLCHAIN=stable -ENV TARGET=aarch64-unknown-linux-musl -ENV TOOL=aarch64-linux-musl - -RUN \ - apt-get update && \ - apt-get upgrade -y - -RUN \ - addgroup --gid "${GID}" build && \ - adduser \ - --disabled-password \ - --gecos "" \ - --ingroup build \ - --uid "${UID}" \ - --home /opt/build \ - build - -ADD https://sh.rustup.rs /opt/build/rustup.sh - -RUN \ - chown -R build:build /opt/build - -USER build -WORKDIR /opt/build - -ENV PATH=/opt/build/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -RUN \ - chmod +x rustup.sh && \ - ./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \ - rustup target add $TARGET - -FROM aarch64-builder as builder - -ARG TAG=main -ARG REPOSITORY=https://git.asonix.dog/asonix/warriors-names -ARG BINARY=warriors-names - -RUN \ - git clone -b $TAG $REPOSITORY repo - -WORKDIR /opt/build/repo - -RUN \ - cargo build --release --target $TARGET && \ - $TOOL-strip target/$TARGET/release/$BINARY - -FROM arm64v8/alpine:3.11 - -ARG UID=991 -ARG GID=991 -ARG BINARY=warriors-names - -COPY --from=builder /opt/build/repo/target/aarch64-unknown-linux-musl/release/$BINARY /usr/bin/$BINARY - -RUN \ - apk add tini && \ - addgroup -g $GID warriors && \ - adduser -D -G warriors -u $UID -g "" -h /opt/warriors warriors - -RUN \ - chown -R warriors:warriors /mnt - -VOLUME /mnt -WORKDIR /opt/warriors -USER warriors -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/usr/bin/warriors-names"] diff --git a/docker/prod/deploy.sh b/docker/prod/deploy.sh deleted file mode 100755 index 0fa6852..0000000 --- a/docker/prod/deploy.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -function require() { - if [ "$1" = "" ]; then - echo "input '$2' required" - print_help - exit 1 - fi -} - -function print_help() { - echo "deploy.sh" - echo "" - echo "Usage:" - echo " deploy.sh [tag]" - echo "" - echo "Args:" - echo " tag: The git tag to be applied to the repository and docker build" - echo " branch: The git branch to use for tagging and publishing" -} - -function build_image() { - tag=$1 - arch=$2 - - docker build \ - --pull \ - --build-arg TAG=$tag \ - -t asonix/warriors-names:$arch-$tag \ - -t asonix/warriors-names:$arch-latest \ - -f Dockerfile.$arch \ - . - - docker push asonix/warriors-names:$arch-$tag - docker push asonix/warriors-names:$arch-latest -} - -# Creating the new tag -new_tag="$1" -branch="$2" - -require "$new_tag" "tag" -require "$branch" "branch" - -if ! docker run --rm -it arm64v8/alpine:3.11 /bin/sh -c 'echo "docker is configured correctly"' -then - echo "docker is not configured to run on qemu-emulated architectures, fixing will require sudo" - sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -fi - -set -xe - -git checkout $branch - -# Changing the docker-compose prod -sed -i "s/asonix\/warriors-names:.*/asonix\/warriors-names:$new_tag/" docker-compose.yml -git add ../prod/docker-compose.yml - -# The commit -git commit -m"Version $new_tag" -git tag $new_tag - -# Push -git push origin $new_tag -git push - -# Build for arm64v8, arm32v7, and amd64 -build_image $new_tag arm64v8 -build_image $new_tag arm32v7 -build_image $new_tag amd64 - -# Build for other archs -# TODO - -./manifest.sh asonix/warriors-names $new_tag -./manifest.sh asonix/warriors-names latest diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 092bc98..84d4a6b 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.3' services: warriors-names: - image: asonix/warriors-names:v0.2.0 + image: asonix/warriors-names:v0.2.1 restart: always volumes: - ./volumes/warriors-names:/opt/warriors diff --git a/docker/prod/manifest.sh b/docker/prod/manifest.sh deleted file mode 100755 index a249ef0..0000000 --- a/docker/prod/manifest.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -function require() { - if [ "$1" = "" ]; then - echo "input '$2' required" - print_help - exit 1 - fi -} -function print_help() { - echo "deploy.sh" - echo "" - echo "Usage:" - echo " manifest.sh [repository] [tag]" - echo "" - echo "Args:" - echo " repository: The docker repository hosting the images" - echo " tag: The git tag to be applied to the image manifest" -} - -repo=$1 -new_tag=$2 - -require "$repo" "repository" -require "$new_tag" "tag" - -set -xe - -docker manifest create $repo:$new_tag \ - -a $repo:arm64v8-$new_tag \ - -a $repo:arm32v7-$new_tag \ - -a $repo:amd64-$new_tag - -docker manifest annotate $repo:$new_tag \ - $repo:arm64v8-$new_tag --os linux --arch arm64 --variant v8 - -docker manifest annotate $repo:$new_tag \ - $repo:arm32v7-$new_tag --os linux --arch arm --variant v7 - -docker manifest annotate $repo:$new_tag \ - $repo:amd64-$new_tag --os linux --arch amd64 - -docker manifest push $repo:$new_tag --purge