2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-09 22:14:59 +00:00

dev build works with imagemagick

This commit is contained in:
asonix 2020-06-15 14:20:25 -05:00
parent 84c10edd0e
commit 0801c1141f
9 changed files with 462 additions and 36 deletions

155
Cargo.lock generated
View file

@ -444,6 +444,30 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42"
[[package]]
name = "bindgen"
version = "0.53.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5"
dependencies = [
"bitflags",
"cexpr",
"cfg-if",
"clang-sys",
"clap",
"env_logger",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"which",
]
[[package]]
name = "bitflags"
version = "1.2.1"
@ -548,6 +572,15 @@ version = "1.0.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
[[package]]
name = "cexpr"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
dependencies = [
"nom",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
@ -565,6 +598,17 @@ dependencies = [
"time 0.1.43",
]
[[package]]
name = "clang-sys"
version = "0.29.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "clap"
version = "2.33.1"
@ -736,6 +780,19 @@ dependencies = [
"syn",
]
[[package]]
name = "env_logger"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]]
name = "fake-simd"
version = "0.1.2"
@ -946,6 +1003,12 @@ version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "h2"
version = "0.2.5"
@ -1011,6 +1074,15 @@ version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
[[package]]
name = "humantime"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
dependencies = [
"quick-error",
]
[[package]]
name = "idna"
version = "0.2.0"
@ -1117,12 +1189,28 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
[[package]]
name = "libc"
version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
[[package]]
name = "libloading"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
dependencies = [
"cc",
"winapi 0.3.8",
]
[[package]]
name = "linked-hash-map"
version = "0.5.3"
@ -1162,6 +1250,17 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
[[package]]
name = "magick_rust"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef1258fe816e2f16c40532a167718321ec78178984a08b62fca6f6a45784bd33"
dependencies = [
"bindgen",
"libc",
"pkg-config",
]
[[package]]
name = "match_cfg"
version = "0.1.0"
@ -1272,6 +1371,16 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "nom"
version = "5.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
dependencies = [
"memchr",
"version_check",
]
[[package]]
name = "num-integer"
version = "0.1.43"
@ -1365,6 +1474,12 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "percent-encoding"
version = "2.1.0"
@ -1385,6 +1500,7 @@ dependencies = [
"futures",
"gif",
"image",
"magick_rust",
"mime",
"once_cell",
"rand",
@ -1660,6 +1776,12 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
version = "0.2.3"
@ -1807,6 +1929,12 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "signal-hook-registry"
version = "1.2.0"
@ -1974,6 +2102,15 @@ dependencies = [
"syn",
]
[[package]]
name = "termcolor"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.11.0"
@ -2454,6 +2591,15 @@ dependencies = [
"webpki",
]
[[package]]
name = "which"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
dependencies = [
"libc",
]
[[package]]
name = "widestring"
version = "0.4.2"
@ -2488,6 +2634,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"

View file

@ -21,6 +21,7 @@ bytes = "0.5"
futures = "0.3.4"
gif = "0.10.3"
image = "0.23.4"
magick_rust = "0.14.0"
mime = "0.3.1"
once_cell = "1.4.0"
rand = "0.7.3"

View file

@ -4,8 +4,10 @@ ARG UID=1000
ARG GID=1000
ENV TOOLCHAIN=stable
ENV TARGET=x86_64-unknown-linux-gnu
ENV HOST=x86_64-unknown-linux
ENV TARGET=$HOST-gnu
ENV TOOL=x86_64-linux-gnu
ENV ARCH=amd64
RUN \
apt-get update && \
@ -40,14 +42,65 @@ FROM x86_64-builder as builder
USER root
ADD https://imagemagick.org/download/ImageMagick.tar.gz ./
RUN \
dpkg --add-architecture amd64 && \
dpkg --add-architecture $ARCH && \
apt-get update && \
apt-get -y install libgexiv2-dev:amd64
apt-get -y install \
libgexiv2-dev:$ARCH \
libltdl-dev:$ARCH \
libjpeg-dev:$ARCH \
libpng-dev:$ARCH \
libwebp-dev:$ARCH \
libxml2-dev:$ARCH && \
chown build:build ImageMagick.tar.gz
USER build
ENV USER=build
RUN \
tar xvzf ImageMagick.tar.gz && \
mv ImageMagick-* ImageMagick
WORKDIR /opt/build/ImageMagick
RUN \
./configure \
CC=$TOOL-gcc \
CXX=$TOOL-g++ \
--prefix=/imagemagick \
--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_LIB_DIRS=/imagemagick/lib
ENV IMAGE_MAGICK_INCLUDE_DIRS=/imagemagick/include/ImageMagick-7
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/$TOOL/pkgconfig:/usr/lib/$PKGCONFIG:/imagemagick/lib/pkgconfig
ENV CPPFLAGS="$CPPFLAGS -I/imagemagick/include/ImageMagick-7 -I/usr/lib/llvm-6.0/lib/clang/6.0.0/include"
USER build
WORKDIR /opt/build
# Cache deps
RUN \
cargo new repo
@ -58,14 +111,22 @@ COPY Cargo.toml Cargo.lock ./
USER root
RUN \
chown -R build:build ./
chown -R build:build ./ && \
apt-get install -y \
llvm-dev:$ARCH \
libclang-dev:$ARCH \
clang:$ARCH
USER build
RUN \
ls /imagemagick/* && \
ls /imagemagick/*/*
RUN \
mkdir -p ./src && \
echo 'fn main() { println!("Dummy") }' > ./src/main.rs && \
cargo build --release && \
cargo build && \
rm -rf ./src
COPY src ./src/
@ -73,12 +134,12 @@ COPY src ./src/
USER root
RUN \
chown -R build:build ./src && \
rm -r ./target/release/deps/pict_rs-*
rm -r ./target/debug/deps/pict_rs-*
USER build
# Build for release
RUN cargo build --frozen --release
# Build
RUN cargo build --frozen
FROM ubuntu:20.04
@ -86,10 +147,15 @@ ARG UID=1000
ARG GID=1000
RUN apt-get update \
&& apt-get install -y libgexiv2-2
&& apt-get install -y \
libgexiv2-2 \
libgomp1 \
libltdl7
# Copy resources
COPY --from=builder /opt/build/repo/target/release/pict-rs /usr/bin/pict-rs
COPY --from=builder /opt/build/repo/target/debug/pict-rs /usr/bin/pict-rs
COPY --from=builder /imagemagick /imagemagick
RUN \
addgroup -gid "${GID}" pictrs && \

View file

@ -4,8 +4,10 @@ ARG UID=991
ARG GID=991
ENV TOOLCHAIN=stable
ENV TARGET=x86_64-unknown-linux-gnu
ENV HOST=x86_64-unknown-linux
ENV TARGET=$HOST-gnu
ENV TOOL=x86_64-linux-gnu
ENV ARCH=amd64
RUN \
apt-get update && \
@ -40,10 +42,66 @@ FROM x86_64-builder as builder
USER root
ADD https://imagemagick.org/download/ImageMagick.tar.gz ./
RUN \
dpkg --add-architecture amd64 && \
dpkg --add-architecture $ARCH && \
apt-get update && \
apt-get -y install libgexiv2-dev:amd64
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 && \
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
USER build
@ -51,9 +109,6 @@ ARG TAG=master
ARG REPOSITORY=https://git.asonix.dog/asonix/pict-rs
ARG BINARY=pict-rs
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV PKG_CONFIG_PATH=/usr/lib/$TOOL/pkgconfig:/usr/lib/$PKGCONFIG
RUN \
git clone -b $TAG $REPOSITORY repo

View file

@ -4,8 +4,10 @@ ARG UID=991
ARG GID=991
ENV TOOLCHAIN=stable
ENV TARGET=arm-unknown-linux-gnueabihf
ENV HOST=arm-unknown-linux
ENV TARGET=$HOST-gnueabihf
ENV TOOL=arm-linux-gnueabihf
ENV ARCH=armhf
RUN \
apt-get update && \
@ -40,10 +42,70 @@ FROM arm32v7-builder as builder
USER root
ADD https://imagemagick.org/download/ImageMagick.tar.gz ./
RUN \
dpkg --add-architecture armhf && \
dpkg --add-architecture $ARCH && \
apt-get update && \
apt-get -y install libgexiv2-dev:armhf
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
USER build
@ -51,9 +113,6 @@ ARG TAG=master
ARG REPOSITORY=https://git.asonix.dog/asonix/pict-rs
ARG BINARY=pict-rs
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV PKG_CONFIG_PATH=/usr/lib/$TOOL/pkgconfig:/usr/lib/$PKGCONFIG
RUN \
git clone -b $TAG $REPOSITORY repo

View file

@ -4,8 +4,10 @@ ARG UID=991
ARG GID=991
ENV TOOLCHAIN=stable
ENV TARGET=aarch64-unknown-linux-gnu
ENV HOST=aarch64-unknown-linux
ENV TARGET=$HOST-gnu
ENV TOOL=aarch64-linux-gnu
ENV ARCH=arm64
RUN \
apt-get update && \
@ -40,10 +42,66 @@ FROM aarch64-builder as builder
USER root
ADD https://imagemagick.org/download/ImageMagick.tar.gz ./
RUN \
dpkg --add-architecture arm64 && \
dpkg --add-architecture $ARCH && \
apt-get update && \
apt-get -y install libgexiv2-dev:arm64
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 && \
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
USER build
@ -51,9 +109,6 @@ ARG TAG=master
ARG REPOSITORY=https://git.asonix.dog/asonix/pict-rs
ARG BINARY=pict-rs
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV PKG_CONFIG_PATH=/usr/lib/$TOOL/pkgconfig:/usr/lib/$PKGCONFIG
RUN \
git clone -b $TAG $REPOSITORY repo

36
docker/prod/build-image.sh Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
function require() {
if [ "$1" = "" ]; then
echo "input '$2' required"
print_help
exit 1
fi
}
function print_help() {
echo "deploy.sh"
echo ""
echo "Usage:"
echo " deploy.sh [repo] [tag] [arch]"
echo ""
echo "Args:"
echo " repo: The docker repository to publish the image"
echo " tag: The tag applied to the docker image"
echo " arch: The architecuture of the doker image"
}
REPO=$1
TAG=$2
ARCH=$3
require "$REPO" repo
require "$TAG" tag
require "$ARCH" arch
docker build \
--pull \
--build-arg TAG=$TAG \
-t $REPO:$ARCH-$TAG \
-f Dockerfile.$ARCH \
.

View file

@ -22,13 +22,7 @@ function build_image() {
tag=$1
arch=$2
docker build \
--pull \
--build-arg TAG=$tag \
-t asonix/pictrs:$arch-$tag \
-t asonix/pictrs:$arch-latest \
-f Dockerfile.$arch \
.
./build-image.sh asonix/pictrs $tag $arch
docker push asonix/pictrs:$arch-$tag
docker push asonix/pictrs:$arch-latest

View file

@ -9,7 +9,7 @@ use actix_web::{
use futures::stream::{Stream, TryStreamExt};
use image::{ImageFormat, ImageOutputFormat};
use once_cell::sync::Lazy;
use std::{collections::HashSet, path::PathBuf};
use std::{collections::HashSet, path::PathBuf, sync::Once};
use structopt::StructOpt;
use tracing::{debug, error, info, instrument, Span};
use tracing_subscriber::EnvFilter;
@ -29,6 +29,7 @@ const MEGABYTES: usize = 1024 * 1024;
const HOURS: u32 = 60 * 60;
static CONFIG: Lazy<Config> = Lazy::new(|| Config::from_args());
static MAGICK_INIT: Once = Once::new();
// Try writing to a file
#[instrument(skip(bytes))]
@ -298,6 +299,10 @@ struct UrlQuery {
#[actix_rt::main]
async fn main() -> Result<(), anyhow::Error> {
MAGICK_INIT.call_once(|| {
magick_rust::magick_wand_genesis();
});
if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "info");
}