From 80d9387dbb2c551c087c2f39c38c6db238988e67 Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 15 Jun 2020 20:16:12 -0500 Subject: [PATCH] Hopefully last dockerfile changes for magick, rexiv2 --- docker/dev/Dockerfile | 15 ++++++--------- docker/prod/Dockerfile.amd64 | 7 ++----- docker/prod/Dockerfile.arm32v7 | 14 ++++---------- docker/prod/Dockerfile.arm64v8 | 7 ++----- 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 0556086..0b9eb49 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -1,17 +1,14 @@ FROM rustembedded/cross:x86_64-unknown-linux-gnu AS x86_64-builder -ARG UID=1000 -ARG GID=1000 - RUN \ apt-get update && \ apt-get upgrade -y && \ - addgroup --gid "${GID}" build && \ + addgroup --gid 991 build && \ adduser \ --disabled-password \ --gecos "" \ --ingroup build \ - --uid "${UID}" \ + --uid 991 \ --home /opt/build \ build @@ -130,7 +127,7 @@ ENV \ RUN \ mkdir -p ./src && \ echo 'fn main() { println!("Dummy") }' > ./src/main.rs && \ - cargo build && \ + cargo build --release && \ rm -rf ./src COPY src ./src/ @@ -138,11 +135,11 @@ COPY src ./src/ USER root RUN \ chown -R build:build ./src && \ - rm -r ./target/debug/deps/pict_rs-* + rm -r ./target/release/deps/pict_rs-* USER build -RUN cargo build --frozen +RUN cargo build --release --frozen FROM ubuntu:20.04 @@ -169,7 +166,7 @@ RUN \ pictrs COPY --from=builder /imagemagick /imagemagick -COPY --from=builder /opt/build/repo/target/debug/$BINARY /usr/bin/$BINARY +COPY --from=builder /opt/build/repo/target/release/$BINARY /usr/bin/$BINARY VOLUME /mnt WORKDIR /opt/pictrs diff --git a/docker/prod/Dockerfile.amd64 b/docker/prod/Dockerfile.amd64 index 6c681be..21b77f1 100644 --- a/docker/prod/Dockerfile.amd64 +++ b/docker/prod/Dockerfile.amd64 @@ -1,17 +1,14 @@ FROM rustembedded/cross:x86_64-unknown-linux-gnu AS x86_64-builder -ARG UID=991 -ARG GID=991 - RUN \ apt-get update && \ apt-get upgrade -y && \ - addgroup --gid "${GID}" build && \ + addgroup --gid 991 build && \ adduser \ --disabled-password \ --gecos "" \ --ingroup build \ - --uid "${UID}" \ + --uid 991 \ --home /opt/build \ build diff --git a/docker/prod/Dockerfile.arm32v7 b/docker/prod/Dockerfile.arm32v7 index 802cec9..c71dde2 100644 --- a/docker/prod/Dockerfile.arm32v7 +++ b/docker/prod/Dockerfile.arm32v7 @@ -1,17 +1,14 @@ FROM rustembedded/cross:arm-unknown-linux-gnueabihf AS arm32v7-builder -ARG UID=991 -ARG GID=991 - RUN \ apt-get update && \ apt-get upgrade -y && \ - addgroup --gid "${GID}" build && \ + addgroup --gid 991 build && \ adduser \ --disabled-password \ --gecos "" \ --ingroup build \ - --uid "${UID}" \ + --uid 991 \ --home /opt/build \ build @@ -59,9 +56,6 @@ RUN \ libclang-dev \ clang \ 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 @@ -79,7 +73,7 @@ ENV \ PKG_CONFIG_PATH=/usr/lib/$TOOL/pkgconfig:/usr/lib/pkgconfig \ LD_LIBRARY_PATH=/usr/lib/$TOOL \ LD_RUN_PATH=$LD_RUN_PATH:/usr/lib/$TOOL \ - LDFLAGS="$LDFLAGS -L/usr/lib/$TOOL -Wl,-rpath-link,/usr/lib/$TOOL" \ + LDFLAGS="$LDFLAGS -L/lib/$TOOL -L/usr/lib/$TOOL -Wl,-rpath-link,/usr/lib/$TOOL" \ CFLAGS="$CFLAGS -I/usr/include/$TOOL -I/usr/$TOOL/include -I/usr/include" \ CPPFLAGS="$CPPFLAGS -I/usr/include/$TOOL -I/usr/$TOOL/include -I/usr/include" @@ -124,7 +118,7 @@ ENV \ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/imagemagick/lib \ LD_RUN_PATH=$LD_RUN_PATH:/imagemagick/lib \ LDFLAGS="$LDFLAGS -L/imagemagick/lib" \ - RUSTFLAGS="-L/usr/lib/$TOOL -C link-arg=-Wl,-rpath-link,/usr/lib/$TOOL" \ + RUSTFLAGS="-L/usr/lib/$TOOL -L/lib/$TOOL -C link-arg=-Wl,-rpath-link,/usr/lib/$TOOL -C link-arg=-Wl,-rpath-link,/lib/$TOOL" \ IMAGE_MAGICK_LIB_DIRS=/imagemagick/lib \ IMAGE_MAGICK_INCLUDE_DIRS=/imagemagick/include/ImageMagick-7 \ PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/imagemagick/lib/pkgconfig \ diff --git a/docker/prod/Dockerfile.arm64v8 b/docker/prod/Dockerfile.arm64v8 index 4453d70..39395e1 100644 --- a/docker/prod/Dockerfile.arm64v8 +++ b/docker/prod/Dockerfile.arm64v8 @@ -1,17 +1,14 @@ FROM rustembedded/cross:aarch64-unknown-linux-gnu AS aarch64-builder -ARG UID=991 -ARG GID=991 - RUN \ apt-get update && \ apt-get upgrade -y && \ - addgroup --gid "${GID}" build && \ + addgroup --gid 991 build && \ adduser \ --disabled-password \ --gecos "" \ --ingroup build \ - --uid "${UID}" \ + --uid 991 \ --home /opt/build \ build