diff --git a/docker/dev/Dockerfile.amd64 b/docker/dev/Dockerfile.amd64 deleted file mode 100644 index 3e9c51a..0000000 --- a/docker/dev/Dockerfile.amd64 +++ /dev/null @@ -1,61 +0,0 @@ -# Basic cross-build environment -FROM rustembedded/cross:x86_64-unknown-linux-musl as cross-build - -ARG UID=1000 -ARG GID=1000 - -ENV \ - ARCH=amd64 \ - HOST=x86_64-unknown-linux \ - TOOLCHAIN=stable \ - TARGET=x86_64-unknown-linux-musl \ - BUILD_MODE=release \ - DEBIAN_FRONTEND=noninteractive - -RUN \ - sed 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list > /etc/apt/sources.list.d/ports.list && \ - sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list && \ - addgroup --gid $GID build && \ - adduser \ - --disabled-password \ - --gecos "" \ - --ingroup build \ - --uid $UID \ - --home /opt/build \ - build - -WORKDIR /opt/build - - -# Environment for Rust -FROM cross-build as rust - -ENV \ - PATH=$PATH:/opt/build/.cargo/bin - -ADD --chown=build:build https://sh.rustup.rs /opt/build/rustup.sh - -USER build - -RUN \ - chmod +x rustup.sh && \ - ./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \ - rustup target add $TARGET - - -# Environment for pict-rs -FROM cross-build as pict-rs-builder - -ENV \ - PATH=$PATH:/opt/build/.cargo/bin - -COPY --from=rust --chown=build:build /opt/build/.cargo /opt/build/.cargo -COPY --from=rust --chown=build:build /opt/build/.rustup /opt/build/.rustup -COPY root/ / - -USER build - -RUN \ - mkdir -p /opt/build/repo - -WORKDIR /opt/build/repo diff --git a/docker/dev/Dockerfile.arm32v7 b/docker/dev/Dockerfile.arm32v7 deleted file mode 100644 index 9a45f66..0000000 --- a/docker/dev/Dockerfile.arm32v7 +++ /dev/null @@ -1,61 +0,0 @@ -# Basic cross-build environment -FROM rustembedded/cross:armv7-unknown-linux-musleabihf as cross-build - -ARG UID=1000 -ARG GID=1000 - -ENV \ - ARCH=armhf \ - HOST=arm-unknown-linux \ - TOOLCHAIN=stable \ - TARGET=armv7-unknown-linux-musleabihf \ - BUILD_MODE=release \ - DEBIAN_FRONTEND=noninteractive - -RUN \ - sed 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list > /etc/apt/sources.list.d/ports.list && \ - sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list && \ - addgroup --gid $GID build && \ - adduser \ - --disabled-password \ - --gecos "" \ - --ingroup build \ - --uid $UID \ - --home /opt/build \ - build - -WORKDIR /opt/build - - -# Environment for Rust -FROM cross-build as rust - -ENV \ - PATH=$PATH:/opt/build/.cargo/bin - -ADD --chown=build:build https://sh.rustup.rs /opt/build/rustup.sh - -USER build - -RUN \ - chmod +x rustup.sh && \ - ./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \ - rustup target add $TARGET - - -# Environment for pict-rs -FROM cross-build as pict-rs-builder - -ENV \ - PATH=$PATH:/opt/build/.cargo/bin - -COPY --from=rust --chown=build:build /opt/build/.cargo /opt/build/.cargo -COPY --from=rust --chown=build:build /opt/build/.rustup /opt/build/.rustup -COPY root/ / - -USER build - -RUN \ - mkdir -p /opt/build/repo - -WORKDIR /opt/build/repo diff --git a/docker/dev/Dockerfile.arm64v8 b/docker/dev/Dockerfile.arm64v8 deleted file mode 100644 index 9de7c21..0000000 --- a/docker/dev/Dockerfile.arm64v8 +++ /dev/null @@ -1,61 +0,0 @@ -# Basic cross-build environment -FROM rustembedded/cross:aarch64-unknown-linux-musl as cross-build - -ARG UID=1000 -ARG GID=1000 - -ENV \ - ARCH=arm64 \ - HOST=aarch64-unknown-linux \ - TOOLCHAIN=stable \ - TARGET=aarch64-unknown-linux-musl \ - BUILD_MODE=release \ - DEBIAN_FRONTEND=noninteractive - -RUN \ - sed 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list > /etc/apt/sources.list.d/ports.list && \ - sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list && \ - addgroup --gid $GID build && \ - adduser \ - --disabled-password \ - --gecos "" \ - --ingroup build \ - --uid $UID \ - --home /opt/build \ - build - -WORKDIR /opt/build - - -# Environment for Rust -FROM cross-build as rust - -ENV \ - PATH=$PATH:/opt/build/.cargo/bin - -ADD --chown=build:build https://sh.rustup.rs /opt/build/rustup.sh - -USER build - -RUN \ - chmod +x rustup.sh && \ - ./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \ - rustup target add $TARGET - - -# Environment for pict-rs -FROM cross-build as pict-rs-builder - -ENV \ - PATH=$PATH:/opt/build/.cargo/bin - -COPY --from=rust --chown=build:build /opt/build/.cargo /opt/build/.cargo -COPY --from=rust --chown=build:build /opt/build/.rustup /opt/build/.rustup -COPY root/ / - -USER build - -RUN \ - mkdir -p /opt/build/repo - -WORKDIR /opt/build/repo diff --git a/docker/dev/dev.sh b/docker/dev/dev.sh deleted file mode 100755 index 3be7e9a..0000000 --- a/docker/dev/dev.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -ARCH=${1:-amd64} - -export USER_ID=$(id -u) -export GROUP_ID=$(id -g) - -sudo docker-compose build --pull -sudo docker-compose run --service-ports pictrs-$ARCH diff --git a/docker/dev/docker-compose.yml b/docker/dev/docker-compose.yml deleted file mode 100644 index 98feea6..0000000 --- a/docker/dev/docker-compose.yml +++ /dev/null @@ -1,47 +0,0 @@ -version: '3.3' - -services: - pictrs-amd64: - build: - context: . - dockerfile: Dockerfile.amd64 - args: - UID: "${USER_ID:-1000}" - GID: "${GROUP_ID:-1000}" - stdin_open: true - tty: true - environment: - - RUST_LOG=info,pict_rs=debug - volumes: - - ../../data:/mnt - - ../../:/opt/build/repo - - pictrs-arm64v8: - build: - context: . - dockerfile: Dockerfile.arm64v8 - args: - UID: "${USER_ID:-1000}" - GID: "${GROUP_ID:-1000}" - stdin_open: true - tty: true - environment: - - RUST_LOG=info,pict_rs=debug - volumes: - - ../../data:/mnt - - ../../:/opt/build/repo - - pictrs-arm32v7: - build: - context: . - dockerfile: Dockerfile.arm32v7 - args: - UID: "${USER_ID:-1000}" - GID: "${GROUP_ID:-1000}" - stdin_open: true - tty: true - environment: - - RUST_LOG=info,pict_rs=debug - volumes: - - ../../data:/mnt - - ../../:/opt/build/repo diff --git a/docker/dev/root/usr/bin/build b/docker/dev/root/usr/bin/build deleted file mode 100755 index 3fd8a11..0000000 --- a/docker/dev/root/usr/bin/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -cargo build --target=$TARGET diff --git a/docker/dev/root/usr/bin/check b/docker/dev/root/usr/bin/check deleted file mode 100755 index 25d8af8..0000000 --- a/docker/dev/root/usr/bin/check +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -cargo check --target=$TARGET diff --git a/docker/dev/root/usr/bin/run b/docker/dev/root/usr/bin/run deleted file mode 100755 index 15feab0..0000000 --- a/docker/dev/root/usr/bin/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -cargo run --target=$TARGET -- "$@" diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile deleted file mode 100644 index 3b3c99f..0000000 --- a/docker/prod/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -ARG REPO_ARCH=amd64 - -# cross-build environment -FROM asonix/rust-builder:$REPO_ARCH-latest AS builder - -ARG TAG=main -ARG BINARY=pict-rs -ARG PROJECT=pict-rs -ARG GIT_REPOSITORY=https://git.asonix.dog/asonix/$PROJECT - -ENV\ - BINARY=${BINARY} - -ADD \ - --chown=build:build \ - $GIT_REPOSITORY/archive/$TAG.tar.gz \ - /opt/build/repo.tar.gz - -RUN \ - tar zxf repo.tar.gz - -WORKDIR /opt/build/$PROJECT - -RUN \ - build - -# production environment -FROM asonix/rust-runner:$REPO_ARCH-latest - -USER root - -COPY --from=builder \ - /opt/build/binary \ - /usr/local/bin/application - -RUN \ - apk add ffmpeg imagemagick exiftool - -RUN \ - chown -R app:app /mnt - -COPY root/ / - -VOLUME /mnt -USER app -EXPOSE 8080 -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/usr/local/bin/application", "-p", "/mnt"] diff --git a/docker/prod/build-image.sh b/docker/prod/build-image.sh deleted file mode 100755 index 2782f1e..0000000 --- a/docker/prod/build-image.sh +++ /dev/null @@ -1,37 +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 [repo] [tag] [arch]" - echo "" - echo "Args:" - echo " repo: The docker repository to publish the image" - echo " tag: The tag applied to the docker image" - echo " arch: The architecuture of the doker image" -} - -REPO=$1 -TAG=$2 -ARCH=$3 - -require "$REPO" repo -require "$TAG" tag -require "$ARCH" arch - -sudo docker build \ - --pull \ - --build-arg TAG=$TAG \ - --build-arg REPO_ARCH=$ARCH \ - -t $REPO:$ARCH-$TAG \ - -f Dockerfile \ - . diff --git a/docker/prod/deploy.sh b/docker/prod/deploy.sh deleted file mode 100755 index 2ffb91b..0000000 --- a/docker/prod/deploy.sh +++ /dev/null @@ -1,87 +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] [branch] [push]" - 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" - echo " push: Whether or not to push the image" - echo "" - echo "Examples:" - echo " ./deploy.sh v0.3.0-alpha.13 main true" - echo " ./deploy.sh v0.3.0-alpha.13-shell-out asonix/shell-out false" -} - -function build_image() { - tag=$1 - arch=$2 - push=$3 - - ./build-image.sh asonix/pictrs $tag $arch - - sudo docker tag asonix/pictrs:$arch-$tag asonix/pictrs:$arch-latest - - if [ "$push" == "true" ]; then - sudo docker push asonix/pictrs:$arch-$tag - sudo docker push asonix/pictrs:$arch-latest - fi -} - -# Creating the new tag -new_tag="$1" -branch="$2" -push=$3 - -require "$new_tag" "tag" -require "$branch" "branch" -require "$push" "push" - -if ! sudo 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\/pictrs:.*/asonix\/pictrs:$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 $push -build_image $new_tag arm32v7 $push -build_image $new_tag amd64 $push - -# Build for other archs -# TODO - -if [ "$push" == "true" ]; then - ./manifest.sh pictrs $new_tag - ./manifest.sh pictrs latest - - # pushd ../../ - # cargo publish - # popd -fi diff --git a/docker/prod/manifest.sh b/docker/prod/manifest.sh deleted file mode 100755 index d426a97..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 [repo] [tag]" - echo "" - echo "Args:" - echo " repo: The docker repository to update" - echo " tag: The git tag to be applied to the image manifest" -} - -REPO=$1 -TAG=$2 - -require "$REPO" "repo" -require "$TAG" "tag" - -set -xe - -sudo docker manifest create asonix/$REPO:$TAG \ - -a asonix/$REPO:arm64v8-$TAG \ - -a asonix/$REPO:arm32v7-$TAG \ - -a asonix/$REPO:amd64-$TAG - -sudo docker manifest annotate asonix/$REPO:$TAG \ - asonix/$REPO:arm64v8-$TAG --os linux --arch arm64 --variant v8 - -sudo docker manifest annotate asonix/$REPO:$TAG \ - asonix/$REPO:arm32v7-$TAG --os linux --arch arm --variant v7 - -sudo docker manifest annotate asonix/$REPO:$TAG \ - asonix/$REPO:amd64-$TAG --os linux --arch amd64 - -sudo docker manifest push asonix/$REPO:$TAG --purge