mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +00:00
74 lines
1.5 KiB
Text
74 lines
1.5 KiB
Text
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=master
|
|
ARG REPOSITORY=https://git.asonix.dog/asonix/pict-rs
|
|
ARG BINARY=pict-rs
|
|
|
|
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=pict-rs
|
|
|
|
COPY --from=builder /opt/build/repo/target/arm-unknown-linux-musleabihf/release/$BINARY /usr/bin/$BINARY
|
|
|
|
RUN \
|
|
apk add tini && \
|
|
addgroup -g $GID pictrs && \
|
|
adduser -D -G pictrs -u $UID -g "" -h /opt/pictrs pictrs
|
|
|
|
RUN \
|
|
chown -R pictrs:pictrs /mnt
|
|
|
|
VOLUME /mnt
|
|
WORKDIR /opt/pictrs
|
|
USER pictrs
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"]
|