Skip to content

Commit

Permalink
Switch to discourse/ruby:3.3.4-bookworm-slim
Browse files Browse the repository at this point in the history
  • Loading branch information
tgxworld committed Aug 30, 2024
1 parent cfe8aa0 commit b2dab18
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 48 deletions.
6 changes: 3 additions & 3 deletions image/auto_build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
discourse_dev_amd64: {
name: "discourse_dev",
tag: "discourse/discourse_dev:build_amd64",
extra_args: "--build-arg=\"from_tag=build_slim_amd64\""
extra_args: "--build-arg=\"from_tag=build_slim_amd64\"",
},
discourse_dev_arm64: {
name: "discourse_dev",
tag: "discourse/discourse_dev:build_arm64",
extra_args: "--platform linux/arm64 --build-arg=\"from_tag=build_slim_arm64\""
}
extra_args: "--platform linux/arm64 --build-arg=\"from_tag=build_slim_arm64\"",
},
}

def run(command)
Expand Down
33 changes: 17 additions & 16 deletions image/base/install-oxipng
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
set -e

# version check: https://github.com/shssoichiro/oxipng/releases
OXIPNG_VERSION="8.0.0"
OXIPNG_HASH="ef96d6340e70900de0a38ace8f5f20878f6c256b18b0c59cd87f2b515437b87b"
OXIPNG_ARCHIVE="v${OXIPNG_VERSION}.tar.gz"
OXIPNG_DIR="oxipng-${OXIPNG_VERSION}"
OXIPNG_VERSION="9.1.2"
dpkgArch="$(dpkg --print-architecture)"

# Install other deps
apt-get -y install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng

cd /tmp
wget -q https://github.com/shssoichiro/oxipng/archive/refs/tags/${OXIPNG_ARCHIVE}
sha256sum ${OXIPNG_ARCHIVE}
echo "${OXIPNG_HASH} ${OXIPNG_ARCHIVE}" | sha256sum -c
case "${dpkgArch##*-}" in
amd64) OXIPNG_FILE="oxipng-${OXIPNG_VERSION}-x86_64-unknown-linux-musl.tar.gz"; OXIPNG_HASH='211d53f3781be4a71566fbaad6611a3da018ac9b22d500651b091c2b42ebe318' ;;
arm64) OXIPNG_FILE="oxipng-${OXIPNG_VERSION}-aarch64-unknown-linux-musl.tar.gz"; OXIPNG_HASH='818d47d7195e1e0c4d58a9f3b6fd84aa3cd21770c60c876e73e2e6a17ca69b52' ;;
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;;
esac

tar -zxf ${OXIPNG_ARCHIVE}
cd ${OXIPNG_DIR}
# Install other deps
apt -y -q install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng

CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse /usr/local/cargo/bin/cargo build --release
cp target/release/oxipng /usr/local/bin
mkdir /oxipng-install
cd /oxipng-install

cd / && rm -fr /tmp/${OXIPNG_DIR} && rm -f /tmp/${OXIPNG_ARCHIVE}
wget -q https://github.com/shssoichiro/oxipng/releases/download/v${OXIPNG_VERSION}/${OXIPNG_FILE}
sha256sum ${OXIPNG_FILE}
echo "${OXIPNG_HASH} ${OXIPNG_FILE}" | sha256sum -c
tar --strip-components=1 -xzf $OXIPNG_FILE
cp -v ./oxipng /usr/local/bin
cd / && rm -fr /oxipng-install
16 changes: 0 additions & 16 deletions image/base/install-ruby

This file was deleted.

12 changes: 2 additions & 10 deletions image/base/slim.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
# VERSION: release

ARG DEBIAN_RELEASE=bookworm
FROM debian:${DEBIAN_RELEASE}-slim
FROM discourse/ruby:3.3.4-${DEBIAN_RELEASE}-slim

ARG DEBIAN_RELEASE
ARG RUBY_VERSION=3.3.4
ENV PG_MAJOR=13 \
RUBY_ALLOCATOR=/usr/lib/libjemalloc.so \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
LEFTHOOK=0 \
RUBY_VERSION=${RUBY_VERSION} \
DEBIAN_RELEASE=${DEBIAN_RELEASE}

#LABEL maintainer="Sam Saffron \"https://twitter.com/samsaffron\""
Expand Down Expand Up @@ -92,10 +87,8 @@ RUN gpg --import /tmp/nginx_public_keys.key &&\
ADD install-redis /tmp/install-redis
RUN /tmp/install-redis

ADD install-rust /tmp/install-rust
ADD install-ruby /tmp/install-ruby
ADD install-oxipng /tmp/install-oxipng
RUN /tmp/install-rust && /tmp/install-ruby $RUBY_VERSION && /tmp/install-oxipng && rustup self uninstall -y
RUN /tmp/install-oxipng

RUN echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\
gem update --system
Expand All @@ -119,7 +112,6 @@ RUN rm -fr /usr/share/man &&\
rm -fr /usr/share/vim/vim74/tutor &&\
rm -fr /usr/local/share/doc &&\
rm -fr /usr/local/share/ri &&\
rm -fr /usr/local/share/ruby-build &&\
rm -fr /var/lib/apt/lists/* &&\
rm -fr /root/.gem &&\
rm -fr /root/.npm &&\
Expand Down
9 changes: 6 additions & 3 deletions image/discourse_dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ ADD redis.template.yml /pups/redis.yml
RUN /pups/bin/pups /pups/redis.yml

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

# get postgres going
ADD postgres.template.yml /pups/postgres.yml
Expand Down

0 comments on commit b2dab18

Please sign in to comment.