2020-06-15 02:41:45 +00:00
|
|
|
FROM rustembedded/cross:arm-unknown-linux-gnueabihf AS arm32v7-builder
|
2020-06-08 01:16:18 +00:00
|
|
|
|
|
|
|
ARG UID=991
|
|
|
|
ARG GID=991
|
|
|
|
|
2020-06-08 17:43:28 +00:00
|
|
|
ENV TOOLCHAIN=stable
|
2020-06-15 19:20:25 +00:00
|
|
|
ENV HOST=arm-unknown-linux
|
|
|
|
ENV TARGET=$HOST-gnueabihf
|
2020-06-15 02:41:45 +00:00
|
|
|
ENV TOOL=arm-linux-gnueabihf
|
2020-06-15 19:20:25 +00:00
|
|
|
ENV ARCH=armhf
|
2020-06-08 01:16:18 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-06-15 02:41:45 +00:00
|
|
|
ENV PATH=$PATH:/opt/build/.cargo/bin
|
2020-06-08 01:16:18 +00:00
|
|
|
|
|
|
|
RUN \
|
|
|
|
chmod +x rustup.sh && \
|
|
|
|
./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \
|
|
|
|
rustup target add $TARGET
|
|
|
|
|
2020-06-08 17:43:28 +00:00
|
|
|
FROM arm32v7-builder as builder
|
|
|
|
|
2020-06-15 02:41:45 +00:00
|
|
|
USER root
|
|
|
|
|
2020-06-15 19:20:25 +00:00
|
|
|
ADD https://imagemagick.org/download/ImageMagick.tar.gz ./
|
|
|
|
|
2020-06-15 02:41:45 +00:00
|
|
|
RUN \
|
2020-06-15 19:20:25 +00:00
|
|
|
dpkg --add-architecture $ARCH && \
|
2020-06-15 02:41:45 +00:00
|
|
|
apt-get update && \
|
2020-06-15 19:20:25 +00:00
|
|
|
apt-get -y install \
|
|
|
|
libgexiv2-dev:$ARCH \
|
|
|
|
libltdl-dev:$ARCH \
|
|
|
|
libjpeg-dev:$ARCH \
|
|
|
|
libpng-dev:$ARCH \
|
|
|
|
libwebp-dev:$ARCH \
|
|
|
|
libxml2-dev:$ARCH \
|
|
|
|
liblzma-dev:$ARCH \
|
|
|
|
libexpat1-dev:$ARCH && \
|
|
|
|
ln -s /usr/lib/$TOOL/libpcre.so /usr/lib/$TOOL/libpcre.so.3 && \
|
|
|
|
ln -s /usr/lib/$TOOL/libz.so /usr/lib/$TOOL/libz.so.1 && \
|
|
|
|
ln -s /usr/lib/$TOOL/libexpatw.so /usr/lib/$TOOL/libexpat.so.1 && \
|
|
|
|
chown build:build ImageMagick.tar.gz
|
|
|
|
|
|
|
|
|
|
|
|
USER build
|
|
|
|
ENV USER=build
|
|
|
|
|
|
|
|
ENV PKG_CONFIG_ALLOW_CROSS=1
|
|
|
|
ENV PKG_CONFIG_PATH=/usr/lib/$TOOL/pkgconfig:/usr/lib/$PKGCONFIG
|
|
|
|
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/$TOOL
|
|
|
|
ENV LD_RUN_PATH=$LD_RUN_PATH:/usr/lib/$TOOL:/usr/lib
|
|
|
|
ENV LDFLAGS="$LDFLAGS -L/usr/lib/$TOOL -Wl,-rpath-link,/usr/lib/$TOOL"
|
|
|
|
ENV CPPFLAGS="$CPPFLAGS -I/usr/include -I/usr/include/$TOOL"
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
tar xzf ImageMagick.tar.gz && \
|
|
|
|
mv ImageMagick-* ImageMagick
|
|
|
|
|
|
|
|
WORKDIR /opt/build/ImageMagick
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
./configure \
|
|
|
|
CC=$TOOL-gcc \
|
|
|
|
CXX=$TOOL-g++ \
|
|
|
|
--prefix=/imagemagick \
|
|
|
|
--disable-docs \
|
|
|
|
--with-modules \
|
|
|
|
--enable-shared \
|
|
|
|
--disable-static \
|
|
|
|
--without-perl \
|
|
|
|
--with-xml=yes \
|
|
|
|
--with-png=yes \
|
|
|
|
--with-jpeg=yes \
|
|
|
|
--with-webp=yes \
|
|
|
|
--host=$HOST && \
|
|
|
|
make
|
|
|
|
|
|
|
|
USER root
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
make install && \
|
|
|
|
ldconfig /imagemagick/lib
|
|
|
|
|
|
|
|
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/imagemagick/lib
|
|
|
|
ENV LD_RUN_PATH=$LD_RUN_PATH:/imagemagick/lib
|
|
|
|
ENV LDFLAGS="$LDFLAGS -L/imagemagick/lib"
|
|
|
|
ENV RUSTFLAGS="-L/usr/lib/$TOOL -C link-arg=-Wl,-rpath-link,/usr/lib/$TOOL"
|
|
|
|
ENV IMAGE_MAGICK_DIR=/imagemagick
|
2020-06-15 02:41:45 +00:00
|
|
|
|
|
|
|
USER build
|
|
|
|
|
2020-06-08 17:43:28 +00:00
|
|
|
ARG TAG=master
|
|
|
|
ARG REPOSITORY=https://git.asonix.dog/asonix/pict-rs
|
|
|
|
ARG BINARY=pict-rs
|
|
|
|
|
2020-06-08 01:16:18 +00:00
|
|
|
RUN \
|
|
|
|
git clone -b $TAG $REPOSITORY repo
|
|
|
|
|
|
|
|
WORKDIR /opt/build/repo
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
cargo build --release --target $TARGET && \
|
|
|
|
$TOOL-strip target/$TARGET/release/$BINARY
|
|
|
|
|
2020-06-15 02:41:45 +00:00
|
|
|
FROM arm32v7/ubuntu:20.04
|
2020-06-08 01:16:18 +00:00
|
|
|
|
|
|
|
ARG UID=991
|
|
|
|
ARG GID=991
|
|
|
|
ARG BINARY=pict-rs
|
|
|
|
|
2020-06-15 02:41:45 +00:00
|
|
|
COPY --from=builder /opt/build/repo/target/arm-unknown-linux-gnueabihf/release/$BINARY /usr/bin/$BINARY
|
2020-06-08 01:16:18 +00:00
|
|
|
|
|
|
|
RUN \
|
2020-06-15 02:41:45 +00:00
|
|
|
apt-get update && \
|
|
|
|
apt-get -y upgrade && \
|
|
|
|
apt-get -y install tini libgexiv2-2 && \
|
|
|
|
addgroup --gid $GID pictrs && \
|
|
|
|
adduser \
|
|
|
|
--disabled-password \
|
|
|
|
--gecos "" \
|
|
|
|
--ingroup pictrs \
|
|
|
|
--uid $UID \
|
|
|
|
--home /opt/pictrs \
|
|
|
|
pictrs
|
2020-06-08 01:16:18 +00:00
|
|
|
|
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-08 01:16:18 +00:00
|
|
|
WORKDIR /opt/pictrs
|
|
|
|
USER pictrs
|
2020-06-15 02:41:45 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
2020-06-08 01:28:16 +00:00
|
|
|
CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"]
|