Hi there!
Some days ago I started learning Discourse and didn’t find a Dockerfile for Apple/M chips. So I had created my own and I would like to share it with anyone who also wants keep a control over own image.
Also by this post I would like to learn how Discourse and community work. I hope you find my post helpful. You are welcome to provide any feedback/thoughts/questions about my Dockerfile.
My Dockerfile is for Apple/M chips, but can be easily modified
# https://meta.discourse.org/t/install-discourse-on-ubuntu-or-debian-for-development/14727/1
# bash <(wget -qO- https://raw.githubusercontent.com/discourse/install-rails/main/linux)
# https://github.com/discourse/discourse/blob/main/docs/DEVELOPER-ADVANCED.md
FROM ruby:3.2-bookworm
ARG PROJECT_PATH=${PROJECT_PATH:-discourse}
# INSTALL DEPENDENCIES
#
# build-essential - Essential build tools for compiling software
# libxslt1-dev - Library for XSLT processing
# libcurl4-openssl-dev - Library for HTTP requests with SSL support
# libksba8 - Libraries for cryptographic functionality
# libksba-dev - Libraries for cryptographic functionality
# libreadline-dev - Library for GNU readline (interactive command line)
# libssl-dev - SSL/TLS support library
# zlib1g-dev - Compression library
# libsnappy-dev - Snappy compression library
# libyaml-dev - YAML parsing library
# libpq-dev - PostgreSQL client library for database connections
# postgresql-client - PostgreSQL client for interacting with remote PostgreSQL databases
# telnet - Tool for testing network services
# nano - Command-line text editor
# git - Git version control system
# net-tools - Utilities for diagnosing and testing network connections
# dnsutils - Tools for DNS queries
# iputils-ping - Utilities for pinging hosts and testing connectivity
# curl - Curl command-line tool for transferring data with URLs
# wget - Wget command-line tool for downloading files
# tzdata - Timezone data for managing time zones
# advancecomp - Tools for optimizing PNG and MNG files
# jhead - Tool for displaying and manipulating Exif data
# jpegoptim - Tool for optimizing JPEG files
# libjpeg-turbo-progs - Tools for optimizing JPEG files
# optipng - Tool for optimizing PNG files
# pngcrush - Tool for optimizing PNG files
# pngquant - Tool for optimizing PNG files
# gnupg2 - GNU Privacy Guard for secure communication and data storage
# libjpeg-dev - Development files for the JPEG library
# libpng-dev - Development files for the PNG library
# libtiff-dev - Development files for the TIFF library
# libwebp-dev - Development files for the WebP library
# libxml2-dev - Development files for the XML library
# libltdl-dev - Development files for the libtool library
# libfreetype6-dev - Development files for the FreeType library
# liblcms2-dev - Development files for the Little CMS library
# liblqr-1-0-dev - Development files for the Liquid Rescale library
# libfftw3-dev - Development files for the Fastest Fourier Transform in the West library
# ghostscript - Interpreter for the PostScript language and PDF
#
RUN apt-get update -qq && apt-get install -y \
build-essential \
libxslt1-dev \
libcurl4-openssl-dev \
libksba8 \
libksba-dev \
libreadline-dev \
libssl-dev \
zlib1g-dev \
libsnappy-dev \
libyaml-dev \
libpq-dev \
postgresql-client \
telnet \
nano \
git \
net-tools \
dnsutils \
iputils-ping \
curl \
wget \
tzdata \
advancecomp \
jhead \
jpegoptim \
libjpeg-turbo-progs \
optipng \
pngcrush \
pngquant \
gnupg2 \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libwebp-dev \
libxml2-dev \
libltdl-dev \
libfreetype6-dev \
liblcms2-dev \
liblqr-1-0-dev \
libfftw3-dev \
ghostscript \
&& rm -rf /var/lib/apt/lists/*
# WORKING DIRECTORY
#
WORKDIR /tmp
# Download and install ImageMagick 7
RUN cd /tmp && wget https://imagemagick.org/download/ImageMagick.tar.gz && \
tar xvzf ImageMagick.tar.gz && \
cd ImageMagick-* && \
./configure && \
make && \
make install && \
ldconfig /usr/local/lib && \
cd .. && \
rm -rf ImageMagick* && \
magick --version
# OXIPNG - OPTIMIZE PNG FILES (ARM64)
# Choose you specific platform and install required package
# https://github.com/shssoichiro/oxipng/releases/
RUN wget https://github.com/shssoichiro/oxipng/releases/download/v9.1.3/oxipng_9.1.3-1_arm64.deb
RUN dpkg -i oxipng_9.1.3-1_arm64.deb
SHELL ["/bin/bash", "-c"]
# INSTALL NODEJS AND PNPM AND YARN
#
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
RUN source /root/.nvm/nvm.sh && nvm install lts/hydrogen --default
# RUN source /root/.nvm/nvm.sh && \
# corepack enable pnpm && \
# corepack use pnpm@9
RUN source /root/.nvm/nvm.sh && \
npm install -g yarn
# WORKING DIRECTORY
#
WORKDIR /app
# INSTALL RUBY ON RAILS DEPENDENCIES
#
RUN gem install bundler -v 2.5.9
COPY ${PROJECT_PATH}/Gemfile /app/Gemfile
COPY ${PROJECT_PATH}/Gemfile.lock /app/Gemfile.lock
RUN bundle install --frozen
# INSTALL NODEJS DEPENDENCIES
#
RUN source /root/.nvm/nvm.sh && npm install -g svgo
COPY ${PROJECT_PATH}/package.json /app/package.json
COPY ${PROJECT_PATH}/patches /app/patches
RUN source /root/.nvm/nvm.sh && yarn -v
After running the container you can launch project with using simple
bin/ember-cli -u
Happy coding!