* Update base Ubuntu image from 22.04 to 22.10. * Update FFmpeg from 4.4.1 to 5.1.2 * Update MozJPEG from 4.0.3 to 4.1.1. * Update ExifTool from 12.30 to 12.42. The FFmpeg upgrade is necessary for .avif file support. Older versions of ffprobe don't handle .avif files correctly. It either returns an error, or in certain cases it can interpret a static .avif image as a video (since .avif files are basically .mp4 files in disguise).
80 lines
2.2 KiB
Docker
80 lines
2.2 KiB
Docker
FROM ubuntu:22.10 AS base
|
|
|
|
WORKDIR /danbooru
|
|
ENV PATH="/root/.asdf/bin:/root/.asdf/shims:$PATH:/usr/lib/postgresql/14/bin"
|
|
|
|
COPY config/docker/build-base-image.sh .
|
|
|
|
RUN \
|
|
./build-base-image.sh && \
|
|
chmod go+rx /root && \
|
|
useradd --home-dir /root --user-group danbooru && \
|
|
rm build-base-image.sh
|
|
|
|
|
|
|
|
FROM base AS development
|
|
ARG NODE_VERSION=14.15.5
|
|
|
|
RUN \
|
|
apt-get update && \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
build-essential libpq-dev libvips-dev zlib1g-dev \
|
|
curl ca-certificates dirmngr git gpg && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN \
|
|
asdf plugin add nodejs && \
|
|
asdf install nodejs "$NODE_VERSION" && \
|
|
asdf global nodejs "$NODE_VERSION" && \
|
|
npm install --unsafe-perm=true -g yarn && \
|
|
chmod -R go+rx /root/.config # make Yarn config dir readable for non-root
|
|
|
|
COPY Gemfile Gemfile.lock ./
|
|
RUN \
|
|
bundle install --jobs "$(nproc)" && \
|
|
rm -rf "$(gem environment gemdir)/cache" && \
|
|
find "$(gem environment gemdir)" -name "*.o" -delete
|
|
|
|
COPY .yarnrc.yml package.json yarn.lock ./
|
|
COPY .yarn/ ./.yarn/
|
|
RUN yarn install
|
|
|
|
COPY postcss.config.js Rakefile ./
|
|
COPY bin/rails bin/webpack ./bin/
|
|
COPY config/application.rb config/boot.rb config/danbooru_default_config.rb config/webpacker.yml ./config/
|
|
COPY config/webpack/ ./config/webpack/
|
|
COPY public/images ./public/images
|
|
COPY public/fonts ./public/fonts
|
|
COPY app/components/ ./app/components/
|
|
COPY app/javascript/ ./app/javascript/
|
|
|
|
RUN \
|
|
bin/rails assets:precompile && \
|
|
rm -rf \
|
|
node_modules .yarn/cache tmp /usr/local/share/.cache/yarn \
|
|
/root/.yarn/berry/cache /root/.bundle/cache /root/.npm && \
|
|
ln -s /tmp tmp && \
|
|
ln -s packs public/packs-test
|
|
|
|
|
|
|
|
FROM base as production
|
|
|
|
ENV LD_PRELOAD=libjemalloc.so.2
|
|
ENV MALLOC_CONF=background_thread:true,narenas:2,dirty_decay_ms:1000,muzzy_decay_ms:0,tcache:false
|
|
|
|
COPY --from=development /root /root
|
|
COPY --from=development /danbooru /danbooru
|
|
|
|
COPY . .
|
|
ARG SOURCE_COMMIT
|
|
RUN echo "$SOURCE_COMMIT" > REVISION
|
|
|
|
USER danbooru
|
|
ENTRYPOINT ["tini", "--"]
|
|
CMD ["bin/rails", "server"]
|
|
|
|
# https://github.com/opencontainers/image-spec/blob/main/annotations.md
|
|
LABEL org.opencontainers.image.source https://github.com/danbooru/danbooru
|