diff --git a/docker/dev/Dockerfile.amd64 b/docker/dev/Dockerfile.amd64 new file mode 100644 index 0000000..2e38e78 --- /dev/null +++ b/docker/dev/Dockerfile.amd64 @@ -0,0 +1,73 @@ +FROM rustembedded/cross:x86_64-unknown-linux-musl AS builder + +ARG UID=991 +ARG GID=991 + +ARG TOOLCHAIN=stable +ARG TARGET=x86_64-unknown-linux-musl +ARG TOOL=x86_64-linux-musl + +ARG REPOSITORY=https://git.asonix.dog/asonix/pict-rs +ARG TAG=master +ARG BINARY=pict-rs + +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 + +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=pict-rs + +COPY --from=builder /opt/build/repo/target/x86_64-unknown-linux-musl/release/$BINARY /usr/bin/$BINARY + +RUN \ + apk add tini && \ + addgroup -g $GID pictrs && \ + adduser -D -G pictrs -g "" -h /opt/pictrs pictrs + +VOLUME /mnt + +RUN \ + chown -R pictrs:pictrs /mnt + +WORKDIR /opt/pictrs +USER pictrs +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"] diff --git a/docker/dev/Dockerfile.arm32v7 b/docker/dev/Dockerfile.arm32v7 index 305fcc0..1a56925 100644 --- a/docker/dev/Dockerfile.arm32v7 +++ b/docker/dev/Dockerfile.arm32v7 @@ -62,7 +62,12 @@ RUN \ addgroup -g $GID pictrs && \ adduser -D -G pictrs -g "" -h /opt/pictrs pictrs +VOLUME /mnt + +RUN \ + chown -R pictrs:pictrs /mnt + WORKDIR /opt/pictrs USER pictrs ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/usr/bin/pict-rs"] +CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"] diff --git a/docker/dev/Dockerfile.arm64v8 b/docker/dev/Dockerfile.arm64v8 index 1d49ba4..11f3130 100644 --- a/docker/dev/Dockerfile.arm64v8 +++ b/docker/dev/Dockerfile.arm64v8 @@ -62,7 +62,12 @@ RUN \ addgroup -g $GID pictrs && \ adduser -D -G pictrs -g "" -h /opt/pictrs pictrs +VOLUME /mnt + +RUN \ + chown -R pictrs:pictrs /mnt + WORKDIR /opt/pictrs USER pictrs ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/usr/bin/pict-rs"] +CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"] diff --git a/docker/dev/deploy.sh b/docker/dev/deploy.sh index 39881c7..731bd96 100755 --- a/docker/dev/deploy.sh +++ b/docker/dev/deploy.sh @@ -51,7 +51,7 @@ set -xe git checkout master # Changing the docker-compose prod -sed -i "s/asonix\/pictrs:.*/asonix\/pictrs:$new_tag/" ../prod/docker-compose.yml +sed -i "s/asonix\/pictrs:.*/asonix\/pictrs:amd64-$new_tag/" ../prod/docker-compose.yml git add ../prod/docker-compose.yml # The commit @@ -72,6 +72,7 @@ docker push asonix/pictrs:x64-latest # Build for arm64v8 and arm32v7 build_image $new_tag arm64v8 build_image $new_tag arm32v7 +build_image $new_tag amd64 # Build for other archs # TODO diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index c18a9d4..d6a09ba 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -7,7 +7,5 @@ services: ports: - "127.0.0.1:8080:8080" restart: always - environment: - - PICTRS_PATH=/app/data volumes: - - ./volumes/pictrs:/app/data + - ./volumes/pictrs:/mnt