-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reduces the image size by using alpine and cleaning up after some things * Simplify the initial setup instructions slightly * Access via localhost:3000 instead of e621.local
- Loading branch information
Showing
7 changed files
with
85 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,68 @@ | ||
FROM ruby:2.7.3 | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y gnupg2 wget | ||
RUN apt-get update \ | ||
&& apt-get install -y gnupg2 wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Add custom sources | ||
RUN wget -qO - https://deb.nodesource.com/setup_14.x | bash - >/dev/null 2>&1 | ||
RUN wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list | ||
RUN wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - | ||
RUN echo "deb https://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list | ||
RUN wget -qO - https://deb.nodesource.com/setup_14.x | bash - >/dev/null 2>&1 \ | ||
&& wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ | ||
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ | ||
&& wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ | ||
&& echo "deb https://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y ffmpeg postgresql-client-12 nodejs yarn nginx build-essential pkg-config sudo | ||
RUN apt-get update \ | ||
&& apt-get install -y ffmpeg postgresql-client-12 nodejs yarn nginx build-essential pkg-config sudo nano \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# User setup | ||
RUN useradd -m -s /bin/bash -U danbooru | ||
RUN usermod -aG www-data danbooru | ||
RUN echo "%danbooru ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/danbooru | ||
RUN useradd -m -s /bin/bash -U danbooru \ | ||
&& usermod -aG www-data danbooru \ | ||
&& echo "%danbooru ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/danbooru | ||
|
||
# libvips | ||
RUN apt-get install -y libglib2.0-dev libexpat1-dev liblcms2-dev \ | ||
optipng libjpeg62-turbo-dev libjpeg-progs libgif-dev libpng-dev libexif-dev | ||
ARG VIPS_DEPS="libglib2.0-dev libexpat1-dev liblcms2-dev optipng libjpeg62-turbo-dev libjpeg-progs libgif-dev libpng-dev libexif-dev" | ||
ARG VIPS_VERSION=8.10.5 | ||
WORKDIR /tmp | ||
RUN wget -q https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz | ||
RUN tar xf vips-$VIPS_VERSION.tar.gz | ||
WORKDIR /tmp/vips-$VIPS_VERSION | ||
RUN ./configure --prefix=/usr | ||
RUN make install | ||
RUN apt-get update \ | ||
&& apt-get install -y $VIPS_DEPS \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& cd /tmp \ | ||
&& wget -q https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz \ | ||
&& tar xf vips-$VIPS_VERSION.tar.gz \ | ||
&& cd vips-$VIPS_VERSION \ | ||
&& ./configure --prefix=/usr \ | ||
&& make install \ | ||
&& rm /tmp/vips-$VIPS_VERSION.tar.gz \ | ||
&& rm -rf /tmp/vips-$VIPS_VERSION | ||
|
||
# shoreman | ||
RUN wget -O /usr/bin/shoreman https://github.com/chrismytton/shoreman/raw/master/shoreman.sh | ||
RUN chmod +x /usr/bin/shoreman | ||
RUN wget -O /usr/bin/shoreman https://github.com/chrismytton/shoreman/raw/master/shoreman.sh \ | ||
&& chmod +x /usr/bin/shoreman | ||
|
||
# prevent permission issues with volume mounts | ||
RUN mkdir /app | ||
RUN chown danbooru:danbooru /app | ||
RUN mkdir /app/public | ||
RUN chown danbooru:danbooru /app/public | ||
|
||
RUN mkdir /app/node_modules | ||
RUN mkdir /app/public/packs | ||
RUN mkdir /app/public/packs-test | ||
RUN mkdir /app/public/data | ||
|
||
RUN chown danbooru:danbooru /app/node_modules | ||
RUN chown danbooru:danbooru /app/public/packs | ||
RUN chown danbooru:danbooru /app/public/packs-test | ||
RUN chown danbooru:danbooru /app/public/data | ||
|
||
RUN mkdir /home/danbooru/gems | ||
RUN chown danbooru:danbooru /home/danbooru/gems | ||
RUN mkdir /app \ | ||
&& chown danbooru:danbooru /app \ | ||
&& mkdir /app/public \ | ||
&& chown danbooru:danbooru /app/public \ | ||
&& mkdir /app/node_modules \ | ||
&& mkdir /app/public/packs \ | ||
&& mkdir /app/public/packs-test \ | ||
&& mkdir /app/public/data \ | ||
&& chown danbooru:danbooru /app/node_modules \ | ||
&& chown danbooru:danbooru /app/public/packs \ | ||
&& chown danbooru:danbooru /app/public/packs-test \ | ||
&& chown danbooru:danbooru /app/public/data \ | ||
&& mkdir /home/danbooru/gems \ | ||
&& chown danbooru:danbooru /home/danbooru/gems | ||
|
||
USER danbooru | ||
|
||
# Setup secrets | ||
RUN mkdir -p ~/.danbooru/ | ||
RUN openssl rand -hex 32 > ~/.danbooru/secret_token | ||
RUN openssl rand -hex 32 > ~/.danbooru/session_secret_key | ||
RUN chmod 600 ~/.danbooru/* | ||
RUN mkdir -p ~/.danbooru/ \ | ||
&& openssl rand -hex 32 > ~/.danbooru/secret_token \ | ||
&& openssl rand -hex 32 > ~/.danbooru/session_secret_key \ | ||
&& chmod 600 ~/.danbooru/* | ||
|
||
WORKDIR /app | ||
CMD [ "shoreman" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
FROM postgres:12 | ||
ARG BUILD_DEPS="git build-essential make postgresql-server-dev-12 ca-certificates" | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y git build-essential postgresql-server-dev-12 | ||
RUN git clone https://github.com/r888888888/test_parser.git /tmp/test_parser | ||
RUN make -C /tmp/test_parser install | ||
RUN apt-get update && apt-get install -y $BUILD_DEPS --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& git clone https://github.com/r888888888/test_parser.git /tmp/test_parser \ | ||
&& cd /tmp/test_parser \ | ||
&& make install \ | ||
&& rm -rf /tmp/test_parser \ | ||
&& apt-get purge -y --auto-remove $BUILD_DEPS |