mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-20 11:21:14 +00:00
Version v0.3.0-alpha.26-r0
This commit is contained in:
parent
a0f7148924
commit
274dab5366
6 changed files with 51 additions and 278 deletions
48
docker/prod/Dockerfile
Normal file
48
docker/prod/Dockerfile
Normal file
|
@ -0,0 +1,48 @@
|
|||
ARG REPO_ARCH=amd64
|
||||
|
||||
# cross-build environment
|
||||
FROM asonix/$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"]
|
|
@ -1,92 +0,0 @@
|
|||
# cross-build environment
|
||||
FROM rustembedded/cross:x86_64-unknown-linux-musl AS x86_64-builder
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
|
||||
ENV \
|
||||
TOOLCHAIN=stable \
|
||||
TARGET=x86_64-unknown-linux-musl \
|
||||
TOOL=x86_64-linux-musl \
|
||||
BUILD_MODE=release
|
||||
|
||||
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
|
||||
|
||||
# build script
|
||||
FROM x86_64-builder as builder
|
||||
|
||||
ARG TAG=main
|
||||
ARG GIT_REPOSITORY=https://git.asonix.dog/asonix/pict-rs
|
||||
ARG BINARY=pict-rs
|
||||
|
||||
ADD \
|
||||
--chown=build:build \
|
||||
$GIT_REPOSITORY/archive/$TAG.tar.gz \
|
||||
/opt/build/$TAG.tar.gz
|
||||
|
||||
USER build
|
||||
|
||||
RUN \
|
||||
tar zxf $TAG.tar.gz
|
||||
|
||||
WORKDIR /opt/build/pict-rs
|
||||
|
||||
RUN \
|
||||
USER=build cargo build --target $TARGET --$BUILD_MODE && \
|
||||
$TOOL-strip target/$TARGET/$BUILD_MODE/$BINARY
|
||||
|
||||
# production environment
|
||||
FROM amd64/alpine:3.14
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
ARG BINARY=pict-rs
|
||||
ARG BUILD_MODE=release
|
||||
|
||||
COPY --from=builder \
|
||||
/opt/build/pict-rs/target/x86_64-unknown-linux-musl/$BUILD_MODE/$BINARY \
|
||||
/usr/local/bin/$BINARY
|
||||
|
||||
RUN \
|
||||
apk add tini ffmpeg imagemagick exiftool && \
|
||||
addgroup -g $GID pictrs && \
|
||||
adduser -D -G pictrs -u $UID -g "" -h /opt/pict-rs pictrs
|
||||
|
||||
RUN \
|
||||
chown -R pictrs:pictrs /mnt
|
||||
|
||||
COPY root/ /
|
||||
|
||||
VOLUME /mnt
|
||||
WORKDIR /opt/pict-rs
|
||||
USER pictrs
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/usr/local/bin/pict-rs", "-p", "/mnt"]
|
|
@ -1,92 +0,0 @@
|
|||
# cross-build environment
|
||||
FROM rustembedded/cross:arm-unknown-linux-musleabihf AS arm32v7-builder
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
|
||||
ENV \
|
||||
TOOLCHAIN=stable \
|
||||
TARGET=arm-unknown-linux-musleabihf \
|
||||
TOOL=arm-linux-musleabihf \
|
||||
BUILD_MODE=release
|
||||
|
||||
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
|
||||
|
||||
# build script
|
||||
FROM arm32v7-builder as builder
|
||||
|
||||
ARG TAG=main
|
||||
ARG GIT_REPOSITORY=https://git.asonix.dog/asonix/pict-rs
|
||||
ARG BINARY=pict-rs
|
||||
|
||||
ADD \
|
||||
--chown=build:build \
|
||||
$GIT_REPOSITORY/archive/$TAG.tar.gz \
|
||||
/opt/build/$TAG.tar.gz
|
||||
|
||||
USER build
|
||||
|
||||
RUN \
|
||||
tar zxf $TAG.tar.gz
|
||||
|
||||
WORKDIR /opt/build/pict-rs
|
||||
|
||||
RUN \
|
||||
USER=build cargo build --target $TARGET --$BUILD_MODE && \
|
||||
$TOOL-strip target/$TARGET/$BUILD_MODE/$BINARY
|
||||
|
||||
# production environment
|
||||
FROM arm32v7/alpine:3.14
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
ARG BINARY=pict-rs
|
||||
ARG BUILD_MODE=release
|
||||
|
||||
COPY --from=builder \
|
||||
/opt/build/pict-rs/target/arm-unknown-linux-musleabihf/$BUILD_MODE/$BINARY \
|
||||
/usr/local/bin/$BINARY
|
||||
|
||||
RUN \
|
||||
apk add tini ffmpeg imagemagick exiftool && \
|
||||
addgroup -g $GID pictrs && \
|
||||
adduser -D -G pictrs -u $UID -g "" -h /opt/pict-rs pictrs
|
||||
|
||||
RUN \
|
||||
chown -R pictrs:pictrs /mnt
|
||||
|
||||
COPY root/ /
|
||||
|
||||
VOLUME /mnt
|
||||
WORKDIR /opt/pict-rs
|
||||
USER pictrs
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/usr/local/bin/pict-rs", "-p", "/mnt"]
|
|
@ -1,92 +0,0 @@
|
|||
# cross-build environment
|
||||
FROM rustembedded/cross:aarch64-unknown-linux-musl AS aarch64-builder
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
|
||||
ENV \
|
||||
TOOLCHAIN=stable \
|
||||
TARGET=aarch64-unknown-linux-musl \
|
||||
TOOL=aarch64-linux-musl \
|
||||
BUILD_MODE=release
|
||||
|
||||
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
|
||||
|
||||
# build script
|
||||
FROM aarch64-builder as builder
|
||||
|
||||
ARG TAG=main
|
||||
ARG GIT_REPOSITORY=https://git.asonix.dog/asonix/pict-rs
|
||||
ARG BINARY=pict-rs
|
||||
|
||||
ADD \
|
||||
--chown=build:build \
|
||||
$GIT_REPOSITORY/archive/$TAG.tar.gz \
|
||||
/opt/build/$TAG.tar.gz
|
||||
|
||||
USER build
|
||||
|
||||
RUN \
|
||||
tar zxf $TAG.tar.gz
|
||||
|
||||
WORKDIR /opt/build/pict-rs
|
||||
|
||||
RUN \
|
||||
USER=build cargo build --target $TARGET --$BUILD_MODE && \
|
||||
$TOOL-strip target/$TARGET/$BUILD_MODE/$BINARY
|
||||
|
||||
# production environment
|
||||
FROM arm64v8/alpine:3.14
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
ARG BINARY=pict-rs
|
||||
ARG BUILD_MODE=release
|
||||
|
||||
COPY --from=builder \
|
||||
/opt/build/pict-rs/target/aarch64-unknown-linux-musl/$BUILD_MODE/$BINARY \
|
||||
/usr/local/bin/$BINARY
|
||||
|
||||
RUN \
|
||||
apk add tini ffmpeg imagemagick exiftool && \
|
||||
addgroup -g $GID pictrs && \
|
||||
adduser -D -G pictrs -u $UID -g "" -h /opt/pict-rs pictrs
|
||||
|
||||
RUN \
|
||||
chown -R pictrs:pictrs /mnt
|
||||
|
||||
COPY root/ /
|
||||
|
||||
VOLUME /mnt
|
||||
WORKDIR /opt/pict-rs
|
||||
USER pictrs
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/usr/local/bin/pict-rs", "-p", "/mnt"]
|
|
@ -31,6 +31,7 @@ require "$ARCH" arch
|
|||
sudo docker build \
|
||||
--pull \
|
||||
--build-arg TAG=$TAG \
|
||||
--build-arg REPO_ARCH=$ARCH \
|
||||
-t $REPO:$ARCH-$TAG \
|
||||
-f Dockerfile.$ARCH \
|
||||
-f Dockerfile \
|
||||
.
|
||||
|
|
|
@ -2,7 +2,7 @@ version: '3.3'
|
|||
|
||||
services:
|
||||
pictrs:
|
||||
image: asonix/pictrs:v0.3.0-alpha.26
|
||||
image: asonix/pictrs:v0.3.0-alpha.26-r0
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
restart: always
|
||||
|
|
Loading…
Reference in a new issue