From a0a8d7c1ce4fbe993dacdb786ee170b8e7383f59 Mon Sep 17 00:00:00 2001 From: Earlopain Date: Thu, 9 Mar 2023 16:52:23 +0100 Subject: [PATCH] [Docker] Use mutlistage build for iqdb This also pulls in ruby 3 as the repos dependencies got updated --- docker/iqdb/Dockerfile | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/docker/iqdb/Dockerfile b/docker/iqdb/Dockerfile index 86fba4dc1..d44a804b6 100644 --- a/docker/iqdb/Dockerfile +++ b/docker/iqdb/Dockerfile @@ -1,12 +1,11 @@ -FROM ruby:2.7.3-alpine +FROM alpine:3.17 as builder -ADD https://api.github.com/repos/e621ng/iqdbs/git/refs/heads/master /tmp/iqdbs_version.json COPY iqdb.patch /tmp/iqdb.patch ENV IQDB_VERSION=20161008 ENV IQDB_CHECKSUM=daa4812b35f84bc7e2f07661fd9abf73a06738c76beb92252666a86ebaea3c64 +ARG BUILD_DEPS="build-base libjpeg-turbo-dev gd-dev" -RUN apk --no-cache add build-base git libjpeg-turbo-dev gd-dev bash \ - # iqdb +RUN apk --no-cache add $BUILD_DEPS \ && cd /tmp \ && wget -q https://iqdb.org/code/iqdb-$IQDB_VERSION.tar.bz2 \ && echo "$IQDB_CHECKSUM iqdb-$IQDB_VERSION.tar.bz2" | sha256sum -c - \ @@ -14,19 +13,19 @@ RUN apk --no-cache add build-base git libjpeg-turbo-dev gd-dev bash \ && cd iqdb \ && patch -N -i /tmp/iqdb.patch \ && make EXTRADEFS="-include stdint.h" -j$(nproc) \ - && cp iqdb /usr/bin \ - # iqdbs - && git clone https://github.com/e621ng/iqdbs /iqdbs \ - && bundler install --gemfile /iqdbs/Gemfile \ - # cleanup - && rm /tmp/iqdb-$IQDB_VERSION.tar.bz2 \ - && rm -rf /tmp/iqdb \ - && apk del build-base git + && apk del $BUILD_DEPS -# shoreman -RUN wget -O /usr/bin/shoreman https://github.com/chrismytton/shoreman/raw/master/shoreman.sh \ - && chmod +x /usr/bin/shoreman +FROM ruby:3.1.3-alpine3.17 + +RUN apk --no-cache add git libjpeg-turbo gd tzdata + +ADD https://api.github.com/repos/e621ng/iqdbs/git/refs/heads/master /tmp/iqdbs_version.json +RUN git clone https://github.com/e621ng/iqdbs /iqdbs \ + && bundler install --gemfile /iqdbs/Gemfile \ + && gem i foreman + +COPY --from=builder /tmp/iqdb/iqdb /usr/bin/ WORKDIR /iqdbs -CMD [ "shoreman" ] +CMD ["foreman", "start"]