Commit Graph

479 Commits

Author SHA1 Message Date
Joffrey JAFFEUX c622ee5b24
Separate dependencies and browser installation (#956)
- deps as root
- browser as discourse user
2025-05-12 10:11:35 +01:00
Krzysztof Kotlarek 5bb42d2865
Revert "DEV: Set fixed playwright browsers path for test Docker image (#960)" (#961)
This reverts commit 9c2bedb521.
2025-05-12 14:40:20 +08:00
Alan Guo Xiang Tan 9c2bedb521
DEV: Set fixed playwright browsers path for test Docker image (#960) 2025-05-10 06:50:19 +08:00
Joffrey JAFFEUX 4cb4a5912d
Install playwright dependencies in test image (#955)
This step avoids having to install playwright in each CI run.

Note I also removed the yarn check as it shouldn't be necessary anymore.
2025-05-07 15:52:25 +02:00
Alan Guo Xiang Tan 9ec9c0cb6a
Bump Ruby to 3.3.7 (#954) 2025-05-06 09:22:32 +08:00
Jarek Radosz 45c0a02cc7
DEV: Re-add ghostscript to the base image (#945) 2025-02-26 02:28:38 +01:00
Jarek Radosz 78e8b2a4cc
DEV: Use more recent version of libheif (#943) 2025-02-26 01:17:03 +01:00
David Taylor 3715498fc1
Update firefox tar format (#939)
Firefox started distributing `.tar.xz` instead of `.tar.bz2`
2025-02-11 12:11:29 +00:00
Gary Pendergast e570a8c5c1
DEV: Force PNPM v9 to be installed. (#937)
Before upgrading PNPM to v10, we need to get Docker builds running again, so this change temporarily forces PNPM v9 to be installed.
2025-02-04 18:17:32 +11:00
mwaniki-wairungu d9c837c783
FEATURE: Update base image and set default to postgresql 15 (#909)
This updates the default PostgreSQL version to 15.

  * image/base: update default postgres version to 15
  * launcher: bump base image to include postgres 15
  * postgres.template.yml: update default version to 15
  * postgres.15.template.yml: current version template

Legacy version templates:

  * postgres.13.template.yml
  * postgres.12.template.yml
  * postgres.10.template.yml
  * postgres.9.5.template.yml
2025-01-29 10:20:49 +03:00
Jarek Radosz 92ac6cbc9b
DEV: Update ImageMagick to 7.1.1-43 (#929)
We could use a bump, after two years since the last one.
2025-01-28 12:07:56 +01:00
Jarek Radosz c41284d0d1
DEV: Update nginx to 1.26.1 (#930) 2025-01-28 12:07:44 +01:00
Jarek Radosz 79ccbcc532
DEV: Update the workflow to Ubuntu 24.04 (#928)
The current LTS
2025-01-28 08:58:35 +08:00
Bianca Nenciu e44bc08778
Revert "Add new Nginx config to base image (#918)" (#923)
We have decided to go another route and keep the Nginx config in the
Discourse repository, but add the outlets there.

This reverts commit 32dc866c85.
2025-01-23 15:46:29 +08:00
Bianca Nenciu 32dc866c85
Add new Nginx config to base image (#918)
This commit moves the Nginx config from discourse/discourse repository
and updates it with several 'include' statements that serve as extension
outlets.

This change was made to place the config closer to where it is used and
implements an alternative to the "find & replace" hacks.

It is unused at this moment, but all templates and samples will be
updated in a future commit.
2025-01-22 20:13:17 +02:00
Alan Guo Xiang Tan ab957b2f64
Build images with PG 15 installed (#917)
This commit updates the build workflow to build and push an extra base Docker
image with PG 15 installed. The tag is not meant to be permanent and is
just meant to help us update our postgres templates to support PG 15
within the same commit.

The tag will be removed once our `discourse/base:release` ships with PG
15 by default.
2025-01-21 09:59:32 +08:00
Alan Guo Xiang Tan 136c638906
DEV: Remove invalid comment (#916)
This script is used by the build workflow which invalidates the comment
2025-01-16 08:48:16 +08:00
Jarek Radosz 6c5e2d1412
DEV: Remove unused docker images (#915)
1. `monitor` uses a 9 year old base image
2. `discourse_fast_switch` uses a 6 year old base image and references ruby 2.4 and 2.5
3. `discourse_bench` uses an 8 year old base image and references postgres 9.5
2025-01-16 07:52:39 +08:00
Jeff Wong fa85268554
Separate nginx build step (#908)
* Revert "Revert "Move nginx installation into another build step (#897)" (#899)"

This reverts commit 0e767585d6.

* add nginx runtime dependencies
2025-01-14 13:29:19 -08:00
David Taylor 107ffb40fe
Revert "Add nginx config file and support for outlets (#871)" (#912)
This reverts commit 01cbf07622.
2025-01-14 16:44:52 +00:00
Bianca Nenciu 01cbf07622
Add nginx config file and support for outlets (#871)
The nginx config file used to be copied from the discourse/discourse
repository, but it has been now moved in this project, closer to the
place where it is used.

The config has several 'include' statements that implement support for
outlets that templates can then use to extend the default configuration
for various features. This is an alternative to the "find & replace"
hacks.
2025-01-14 17:56:45 +02:00
Jarek Radosz b345430a82
FEATURE: Update node to version 22.x (#910) 2025-01-13 14:01:08 +01:00
Alan Guo Xiang Tan ae194861f8
Bump Redis to 7.0.15 (#907)
Pulls in bug and security fixes since 7.0.7
2025-01-07 13:46:53 +08:00
Alan Guo Xiang Tan 0d0e1eb1de
Clean up firefox tar file in `discourse/discourse_test` image (#904) 2024-12-27 12:51:33 +08:00
Alan Guo Xiang Tan 0e767585d6
Revert "Move nginx installation into another build step (#897)" (#899)
This reverts commit d963389430.

This broke certain assumptions like the `/etc/nginx` directory
exists.
2024-12-19 10:19:13 +08:00
Alan Guo Xiang Tan d963389430
Move nginx installation into another build step (#897)
Avoids polluting the main image with nginx's build dependencies
2024-12-18 07:07:26 +08:00
Alan Guo Xiang Tan b375a7113f
Remove updating of rubygems (#896)
This adds an additional layer of 20mb for no reason. We don't need to be
running the latest version of rubygems all the time.

Even if we need to update rubygems, it should be updated in https://github.com/discourse/docker-ruby
2024-12-17 14:54:12 +08:00
Jeff Wong 5ed07ecc93
Imagemagick enable delegate build and disabled using shared libraries (#889)
compiles to a single portable binary

Create a base builder package with compile time dependencies. Create an
imagemagick_builder to build imagemagick.

The base builder can be extended for other builders.

Add imagemagick runtime dependencies to discourse_dependencies image
avoid -dev libs

Statically compile as much as possible with --disable-shared and
--enable-delegate-build flags.
References:
https://stackoverflow.com/questions/47031789/imagemagick-100-static-build-for-linux
https://www.imagemagick.org/discourse-server/viewtopic.php?t=14259

Add fonts-urw-base35 for NimbusSans-Regular, needed for letter avatar generation

Copy over the resulting magick bin, as well as etc and share files from the
compilation. etc is needed for magick to run, share is not, but contains
translations for errors which Discourse tests are dependent on reading from.

Create symlinks for other magick tooling - imagemagick creates symlink tool
names that Discourse uses. These *could* be dropped if Discourse decided to use
`magick {toolname}` rather than `{toolname}`.

Add nginx compile dependency - building nginx still needs libfreetype6
This was implicitly installed previously. Removing the imagemagick build from
base broke the next nginx build. Add this dependency back in. This dependency
can be removed once we build nginx separately as well.
2024-12-17 13:28:54 +08:00
Alan Guo Xiang Tan e70c3596b8
DEV: Bump rust version to 1.82.0 (#894)
This is to resolve an error we are seeing in our arm64 dev builds

```
24 49.46 error: package `apple-xar v0.20.0` cannot be built because it requires rustc 1.81 or newer, while the currently active rustc version is 1.75.0
24 49.46 Either upgrade to rustc 1.81 or newer, or use
```
2024-12-17 07:57:38 +08:00
Alan Guo Xiang Tan a0be7c92ce
Install `postgresql-client-${PG_MAJOR}` instead of `postgresql-client` (#892)
This ensures that the client tools we installed are compatible with the
version of the Postgres cluster.
2024-12-03 10:51:15 +08:00
Jeff Wong b8f9edab75
jemalloc build with install_lib_shared libraries (#888)
Only output shared lib libraries, we should not need static libraries
2024-11-12 17:54:29 -08:00
Alan Guo Xiang Tan 58e0dce1a8
Bump Ruby to 3.3.6 (#885)
This is a routine update that includes minor bug fixes.

See https://www.ruby-lang.org/en/news/2024/11/05/ruby-3-3-6-released/
2024-11-13 08:49:34 +08:00
Jeff Wong 3792f7155c
DEV: slim image by dropping building jhead from source, and dropping optipng (#884)
jhead from apt pulls in a ton of packages, and optipng isn't used. Reduces compressed image size by 8MB.

main: 648.38MB
compiling jhead + dropping optipng: 640.14MB
2024-11-07 19:41:21 -08:00
Alan Guo Xiang Tan 1ae67ef87e
DEV: Remove cache mounts from image/base Dockerfile (#883)
There are no substantial benefits from using cache mounts here so we
are dropping those mounts.
2024-11-08 07:27:55 +08:00
Jeff Wong 785fda38c2
DEV: slim image, drop unused packages and use cache mounts (#880)
* DEV: slim image, drop unused packages and use cache mounts

apt using caches for /var/cache/apt, /var/cache/debconf, and var/lib/apt.

Drop autoconf and build-essential from installs, in favor of selective cmake,
g++, pkg-config, and patch packages.

drop apt-get -y upgrade in dockerfile. We should inherit upgrades from base
images. No need to apt-mark hold initscripts now that we're not running `upgrade`

Remove calls to vim as we no longer install vim here. Remove comment for
slimming locales as we have now done so.

merge all apt layers, minimizing amount of --mount arguments in dockerfile
2024-11-04 10:49:58 -08:00
Jeff Wong a1d8d0bbcb
DEV: generate only en_us locales (#855)
install locales-all installs 245MB
Generating common and en_us locales installs 22MB

update locales for postgres templates

`locale-gen $LANG` doesn't seem to actually do anything without updates to
`/etc/locale.gen`. Update the scripts to uncomment $LANG before running `update-locale`.
2024-10-14 23:19:13 -07:00
Alan Guo Xiang Tan b47bd562cc
Release `discourse/base` images for `discourse/discourse` stable branch (#864)
This commit updates our `build` workflow to push the following manifests
which can be used to run Discourse against the stable branch.

1. discourse/base:2.0.$TIMESTAMP-stable
2. discourse/base:release-stable

Co-authored-by: David Taylor <david@taylorhq.com>
2024-09-09 19:49:14 +08:00
David Taylor 928adfd09f
Suppress pnpm upgrade notices in logs (#866) 2024-09-06 10:28:15 +01:00
Alan Guo Xiang Tan 189cfe2ac9
Clean up nginx folder after installation. (#865) 2024-09-06 15:09:59 +08:00
David Taylor 87871bc430
Make compatible with pnpm (#854)
Switches behavior based on the presence of `yarn.lock`

See https://github.com/discourse/discourse/pull/28671
2024-09-02 20:55:57 +01:00
Alan Guo Xiang Tan fe48fa2c5c
Switch to `discourse/ruby:3.3.4-bookworm-slim` (#853) 2024-09-02 11:49:43 +08:00
Jeff Wong 44134a21bb
DEV: remove bundle cache (#852)
On the current image this removes ~78MB from the layer

Uncompressed image sizes:
before: 3.3GB
after: 3.23GB
2024-08-30 18:05:34 -07:00
Jeff Wong 7c18fce1b4
DEV: remove oxipng archive in layer (#846)
* DEV: remove oxipng archive in layer

Saves ~52MB for the layer

* DEV: Remove nginx archives

Remove another 1.2MB from image
2024-08-28 19:34:24 -07:00
David Taylor fc61b8a850
DEV: Introduce arm64 dev image and multi-arch manifests (#829)
- Combines dev image build into the `base` job
- Calculates a single timestamp for all builds
- Pushes timestamped per-arch images to Dockerhub for base, base-slim and dev images
- If both arch build jobs are successful, multiarch manifests are generated & pushed
2024-08-26 13:10:28 +08:00
Alan Guo Xiang Tan 84644fcbea
Bump Ruby to 3.3.4 (#836)
Ruby 3.3.4 has fixes for some regressions in 3.3.3. I don't think it
affects us but still good to upgrade.
2024-08-22 12:25:15 +08:00
Alan Guo Xiang Tan 4c58e2b75b
Switch to debian:bookworm-slim image (#831)
Debian Bullseye is EOL.
2024-08-22 10:57:56 +08:00
Alan Guo Xiang Tan 1d7323204b
Ensure uid, gid for postgres, redis and discourse stays consistent (#835)
When updating to `debian/base:bookworm` from `debian/base:bullseye`, we
noticed that the uid of the `postgres` and `redis` user changed leading
to permission issues when trying to access directories of mounted volumn
which was previously created with the old uid. The change is because the
`_apt` user is assigned a uid of `42` in Debian bookworm instead of `100`
in Debian bullseye. As a result, the `postgres` user created by the `postgres`
package is automatically assigned a uid of `100` in Debian bookworm instead of `101` in Debian
bullseye.

This commit updates the `slim.Dockefile` to manually add the `postgres`
user and group assigning it a gid of `104` and uid of `101`. The `redis`
user and group is assigned a uid of `103` and a gid of `106`. The
`discourse` user and group is assigned a uid of `1000` and gid of
`1000`.
2024-08-22 10:57:29 +08:00
David Taylor 98c5337c12
Warmup yarn and bundle caches in dev image (#832)
Uses a multi-stage build with bind mount to avoid adding the discourse repo itself to the layers
2024-08-20 14:51:32 +01:00
David Taylor 7b0e4b45b5
dev: add user-installed gems to PATH (#833)
This is important for usability of things like discourse_theme, and editor tooling (e.g. ruby-lsp)
2024-08-20 14:51:14 +01:00
David Taylor f1c9d8afb2
DEV: Simplify discourse_dev postgres setup (#830)
- Remove manual database creation, and instead promote discourse user to postgres SUPERUSER. This means that `db:drop` and `db:create` commands can be run in the dev image, just like in other local development environments. As well as simplifying things, it fixes turbo_rspec, which was previously impossible in the docker dev environment (because `discourse` didn't have permissions to create the parallel databases)

- Stop pre-migrating test database in dev image. It adds additional build time & image size, and doesn't actually help because core's `bin/docker/boot_dev` script overwrites the container's postgres directory with a volume mount
2024-08-19 16:44:23 +01:00