2020-06-07 23:29:41 +00:00
|
|
|
FROM rustembedded/cross:aarch64-unknown-linux-musl AS builder
|
|
|
|
|
|
|
|
ARG UID=991
|
|
|
|
ARG GID=991
|
|
|
|
|
|
|
|
ARG TOOLCHAIN=stable
|
|
|
|
ARG TARGET=aarch64-unknown-linux-musl
|
|
|
|
ARG TOOL=aarch64-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
|
2020-06-07 23:53:26 +00:00
|
|
|
ARG BINARY=pict-rs
|
2020-06-07 23:29:41 +00:00
|
|
|
|
|
|
|
COPY --from=builder /opt/build/repo/target/aarch64-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
|
|
|
|
|
2020-06-08 01:28:16 +00:00
|
|
|
RUN \
|
|
|
|
chown -R pictrs:pictrs /mnt
|
|
|
|
|
2020-06-08 14:12:12 +00:00
|
|
|
VOLUME /mnt
|
2020-06-07 23:29:41 +00:00
|
|
|
WORKDIR /opt/pictrs
|
|
|
|
USER pictrs
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
2020-06-08 01:28:16 +00:00
|
|
|
CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"]
|