Commit Graph

76 Commits

Author SHA1 Message Date
Opliko
7f3a9968ef feat: docker improvements (#12031)
* use yarn and debian slim build

* feat: update Dockerfile to use multistage builds

* Create main.yml

* remove some useless things from docker context and assume yarn by default

* remove all dotfiles in docker context

* no need for extra build tools, complain to the module author if there is no alpine build

(cherry picked from commit 90516a3c8399e74c38be7115edb39411ba0d86b9)

* specify the config file location instead of creating it

(cherry picked from commit 38e4295d70682f1049fe671ade96eeccd669d908)

* set explicit config path

(cherry picked from commit 8dcc6f249d099cb8939a95511ec13702491958bc)

* fix docker-compose example to use the exposed volumes

* dockerfile: upgrade alpine to 3.16

* dockerignore: add more ignorable entries

* docker-compose: change the way the docker startup process works

* install: pass config path to child process as well

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* setup: move config file resolution up before setup

This fixes issue with different config file location, which will otherwise default on 'config.json', which means the config save won't save to the file we specified

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-entrypoint: don't fix CONFIG_DIR location but fix default location

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-entrypoint: handle missing config file logic

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* README: add simple notice on how to use it

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* add missing semicolons

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-compose: remove multi override, use one big profile instead

However, Docker Compose doesn't support profile-based dependency and this would probably means we have less guarantee about the liveness of the database. But since this is just a sample configuration it should be fine

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* workflows: remove main.yml, add platforms to buildx matrix in docker.yml

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* workflows: set docker buildx to build for amd64 and arm64 only

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-entrypoint: don't force build everytime before start

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-entrypoint: implement init verb

This would allow you to change between "setup" (automated setup using environmental variables which is the current preferred way to run containerized NodeBB) or "install" (web install that guides user to fill in connection information, which is similar to WordPress)

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* README: mention caveat with MongoDB

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* README: add Docker section placeholder for doc migration

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-entrypoint: add SETUP variable support

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-compose: add force flag to ln on setup

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* docker-compose: fix permission issue; docker-compose: fast exit if still no permission on config dir

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>

* fix: remove redundant FROM

* docs: remove docker stuff (in favour of docs entry, nodebb/docs#78) but add link to cloud install docs

* fix: correctly check if directory is writable

* fix: ignore .docker directory

* fix: multi-arch docker builds and chown performance

* chore: bump database image versions

* fix: move from alpine to slim image

* fix: use omit=dev instead of only=prod

* feat: move entrypoint to install directory

* feat: initialize mongodb user

* feat: use separate rebuild stage

* fix: disable eslint for mongodb script

* fix: remove node_modules bind mount

bind mounts don't save data from container, resulting in a LOONG startup

* feat: prepopulate database defaults for installation

* feat: enable persistence in redis container

* docs: add some comments to the compose file

---------

Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>
Co-authored-by: Steve Fan <29133953+stevefan1999-personal@users.noreply.github.com>
Co-authored-by: Steve Fan <19037626d@connect.polyu.hk>
Co-authored-by: Julian Lam <julian@nodebb.org>
2023-11-12 13:38:00 -05:00
renovate[bot]
2eff691299 chore(deps): update redis docker tag to v7.2.3 (#12152)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-07 12:52:48 -05:00
renovate[bot]
762ad16168 chore(deps): update actions/setup-node action to v4 (#12114)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-23 16:07:58 -04:00
renovate[bot]
bb812937f7 chore(deps): update redis docker tag to v7.2.2 (#12097)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-22 09:57:22 -04:00
renovate[bot]
6fa6f73b99 chore(deps): update postgres docker tag to v16 (#12012)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-18 15:32:32 -04:00
renovate[bot]
b423336672 chore(deps): update actions/checkout action to v4 (#11978)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-14 11:07:26 -04:00
renovate[bot]
4ecfe40ea0 chore(deps): update docker/build-push-action action to v5 (#11997)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-14 11:07:11 -04:00
renovate[bot]
478f7c740f chore(deps): update docker/login-action action to v3 (#11998)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-14 11:06:30 -04:00
renovate[bot]
21b280d298 chore(deps): update docker/metadata-action action to v5 (#11999)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-14 11:06:22 -04:00
renovate[bot]
95f7112adc chore(deps): update docker/setup-buildx-action action to v3 (#12000)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-14 11:06:15 -04:00
renovate[bot]
f286d7fa2e chore(deps): update docker/setup-qemu-action action to v3 (#12001)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-14 11:06:08 -04:00
renovate[bot]
a473b5155d chore(deps): update coverallsapp/github-action action to v2.2.3 (#11988)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-08 11:21:26 -04:00
renovate[bot]
0b231fd31b chore(deps): update redis docker tag to v7.2.1 (#11987)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-08 11:21:17 -04:00
renovate[bot]
15c6fd6bf8 chore(deps): update coverallsapp/github-action action to v2.2.2 (#11977)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-05 09:50:46 -04:00
Barış Soner Uşaklı
c989a4a328 remove node 16 from matrix 2023-08-21 13:50:57 -04:00
renovate[bot]
c41a4a0fdd chore(deps): update redis docker tag to v7.2.0 (#11924)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-19 20:31:58 -04:00
renovate[bot]
7ebdfe7153 chore(deps): update mongo docker tag to v7 (#11928)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-19 19:13:10 -04:00
Barış Soner Uşaklı
5602159691 hmm node 20, yummy 2023-08-17 15:04:22 -04:00
renovate[bot]
c838782816 chore(deps): update actions/setup-node action to v3 (#10347)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-15 15:42:43 -04:00
renovate[bot]
f271597941 chore(deps): update mongo docker tag to v6 (#10889)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-15 15:41:58 -04:00
renovate[bot]
adfde1d4e1 chore(deps): update coverallsapp/github-action action to v2.2.1 (#11795)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-13 11:36:16 -04:00
renovate[bot]
40477c85d5 chore(deps): update redis docker tag to v7.0.12 (#11789)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-12 13:19:19 -04:00
renovate[bot]
9282bc58e6 chore(deps): update coverallsapp/github-action action to v2.2.0 (#11690)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-14 09:59:29 -04:00
renovate[bot]
f1e2342d67 chore(deps): update redis docker tag to v7 (#10830)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-16 15:42:37 -04:00
Opliko
412a1ecf93 ci: use GitHub Actions expression instead of handlebars template (#11599)
Apparently Docker Meta Actions overrides, not merely adds, handlebars helpers. So `#if` just doesn't exist and errors out...

As such here is an equivalent using GitHub Actions expression (and this time I tested that it works...)
2023-05-13 14:36:59 -04:00
Opliko
cd7fdfcefd ci: tag with branch name if not default branch
This should prevent failed runs like https://github.com/NodeBB/NodeBB/actions/runs/4959641483
2023-05-12 12:34:12 -04:00
Opliko
163c977d2f ci: add 3.x docker tag 2023-05-07 20:03:21 -04:00
Opliko
c588d741ba ci: only publish latest from master
`latest` tag is currently v2. That happened because of the backported change which is newer than any commits to `master`.

However, this logically shouldn't happen. The expectation for latest would be that it has the, well, the code from the highest version released, not literally the latest commit no matter where it came from. Thankfully metadata action allows for conditional tags and even has a helper for default branch making it not hard-coded (so if NodeBB decided to migrate to `main` or someone in their fork did it'd still work).

The result would be that latest is the latest code in `master`, which I see as similar to the default git workflow (`master` is just latest code, `vX.Y` branches or tags are for using proper releases).
2023-05-07 20:03:21 -04:00
Opliko
0417e5f16c ci: multi-platform docker image (#11479)
* ci: multi-platform build

* ci: remove riscv as node doesn't support it

* ci: correct step name

it's no longer logging in to docker hub

* ci: remove less common architectures

* ci: github actions cache for docker builds

* fix: use `--omit` flag to actually avoid installing dev dependencies

* feat: two-stage build

* feat: add platform-specific rebuild

* fix: run install if target arch is different from build arch

* fix: whitespace

* fix: correct build order

* fix: remove unnecessary conditional

* fix: remove unnecessary platofm specifier

* fix: correct copy
2023-04-28 13:00:34 -04:00
renovate[bot]
fec552d205 chore(deps): update coverallsapp/github-action action to v2.1.2 (#11497)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-21 09:51:22 -04:00
renovate[bot]
f8ae6ef7ef chore(deps): update coverallsapp/github-action action to v2.1.1 (#11494)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-19 09:33:58 -04:00
renovate[bot]
88b02d9004 chore(deps): update coverallsapp/github-action action to v2.1.0 (#11458)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-10 17:37:12 -04:00
Barış Soner Uşaklı
1b98995132 Merge branch 'master' into develop 2023-04-05 15:34:59 -04:00
Opliko
c27567289f ci: publish to ghcr instead of docker hub 2023-04-05 14:38:47 -04:00
renovate[bot]
f286b66fe4 chore(deps): update postgres docker tag to v15 (#10976)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-17 20:15:28 -04:00
renovate[bot]
8ddb302f20 chore(deps): update docker/build-push-action action to v4 (#11245)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-17 18:31:22 -04:00
Barış Soner Uşaklı
fafa130406 chore: up connect-redis to 7.x, drop node 14 (#11376) 2023-03-17 18:30:05 -04:00
renovate[bot]
a5a4b307f3 chore(deps): update coverallsapp/github-action action to v2 (#11369)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-17 12:51:22 -04:00
renovate[bot]
e8e35de390 chore(deps): update coverallsapp/github-action action to v1.2.4 (#11323)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-01 10:55:17 -05:00
Julian Lam
a2fafc2b15 Merge remote-tracking branch 'origin/master' into develop 2022-10-24 14:11:25 -04:00
Julian Lam
c2024f3484 chore: really fix indents this time 2022-10-19 15:29:54 -04:00
Julian Lam
d50512e73c chore: fix indents 2022-10-19 15:28:41 -04:00
Julian Lam
be5d6d29c9 chore: add bootstrap5 to test runner for now 2022-10-19 15:27:24 -04:00
Barış Soner Uşaklı
02ef3e974c Esbuild (#10940)
* ci: add minimum GitHub token permissions for workflows
Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>

* feat: use esbuild for minification

Co-authored-by: Ashish Kurmi <akurmi@stepsecurity.io>
2022-10-06 07:51:13 -04:00
Ashish Kurmi
fe0020fb31 ci: add minimum GitHub token permissions for workflows
Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>
2022-10-05 21:23:18 -04:00
renovate[bot]
5aa55d29f3 chore(deps): update postgres docker tag to v14 (#10829)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-15 10:11:47 -04:00
Julian Lam
2568986c58 Revert "Revert "chore(deps): update docker/build-push-action action to v3""
This reverts commit d2c2f333e1.
2022-08-12 17:15:55 -04:00
Julian Lam
9d446f9282 Revert "Revert "chore(deps): update docker/login-action action to v2""
This reverts commit 887df0e62b.
2022-08-12 17:15:55 -04:00
Julian Lam
c71335218b Revert "Revert "chore(deps): update docker/setup-buildx-action action to v2""
This reverts commit 8936f412d1.
2022-08-12 17:15:54 -04:00
renovate[bot]
8afaed223c chore(deps): update mongo docker tag to v3.7 2022-08-12 17:14:35 -04:00