Archived
Use docker-compose.override.yml pattern for Docker installation
Editing docker-compose.yml directly is overwritten on every pull. The correct approach is a separate Dockerfile.gitea (owned by the operator) referenced from docker-compose.override.yml, which is never touched by upstream updates.
This commit is contained in:
1 parent
ef1953ad62
commit
8dcb499289
1 file changed
+39
-15
@@ -62,20 +62,33 @@ sudo openproject configure
|
|||||||
|
|
||||||
The official OpenProject Docker image bakes all gems and frontend assets in at
|
The official OpenProject Docker image bakes all gems and frontend assets in at
|
||||||
build time, so installing a third-party plugin requires building a custom image.
|
build time, so installing a third-party plugin requires building a custom image.
|
||||||
|
The `docker-compose.yml` provided by OpenProject is overwritten on every update,
|
||||||
|
so all local changes go into `docker-compose.override.yml` and a separate
|
||||||
|
`Dockerfile` that you own.
|
||||||
|
|
||||||
#### 1. Create a `Dockerfile` that extends the official image
|
#### 1. Clone the plugin
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/your-org/openproject-gitea-integration.git \
|
||||||
|
openproject-gitea_integration
|
||||||
|
```
|
||||||
|
|
||||||
|
Place it anywhere convenient — this guide assumes it sits next to your
|
||||||
|
`docker-compose.yml`.
|
||||||
|
|
||||||
|
#### 2. Create `Dockerfile.gitea`
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM openproject/openproject:15
|
FROM openproject/openproject:15
|
||||||
|
|
||||||
# Switch to root to install build tools and re-bundle
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Copy the plugin into the modules directory
|
# Copy the plugin source into the image
|
||||||
COPY --chown=app:app . /app/modules/gitea_integration
|
COPY --chown=app:app openproject-gitea_integration \
|
||||||
|
/app/modules/gitea_integration
|
||||||
|
|
||||||
# Add the gem to a custom Gemfile that OpenProject will merge
|
# Register the gem and recompile assets
|
||||||
RUN echo "group :opf_plugins do\n gem 'openproject-gitea_integration', path: 'modules/gitea_integration'\nend" \
|
RUN echo 'group :opf_plugins do\n gem "openproject-gitea_integration", path: "modules/gitea_integration"\nend' \
|
||||||
> /app/Gemfile.plugins && \
|
> /app/Gemfile.plugins && \
|
||||||
cd /app && \
|
cd /app && \
|
||||||
bundle install --without development test && \
|
bundle install --without development test && \
|
||||||
@@ -86,23 +99,28 @@ RUN echo "group :opf_plugins do\n gem 'openproject-gitea_integration', path: 'm
|
|||||||
USER app
|
USER app
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 2. Build and reference the image in `docker-compose.yml`
|
#### 3. Create `docker-compose.override.yml`
|
||||||
|
|
||||||
|
This file is never touched by OpenProject updates. Point both `web` and
|
||||||
|
`worker` at your custom image — they must use the same image so the plugin is
|
||||||
|
loaded in both processes.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: . # directory containing your Dockerfile and the plugin source
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile.gitea
|
||||||
# … rest of your existing web service config
|
image: openproject-with-gitea:latest
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile.gitea
|
||||||
# … rest of your existing worker service config
|
image: openproject-with-gitea:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 3. Build and restart
|
#### 4. Build and start
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker compose build
|
docker compose build
|
||||||
@@ -110,8 +128,14 @@ docker compose up -d
|
|||||||
docker compose exec web bundle exec rails db:migrate
|
docker compose exec web bundle exec rails db:migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note:** Every time you update the plugin you need to rebuild the image
|
#### Updating the plugin
|
||||||
> (`docker compose build --no-cache`) and restart the stack.
|
|
||||||
|
```shell
|
||||||
|
cd openproject-gitea_integration && git pull && cd ..
|
||||||
|
docker compose build --no-cache
|
||||||
|
docker compose up -d
|
||||||
|
docker compose exec web bundle exec rails db:migrate
|
||||||
|
```
|
||||||
|
|
||||||
### Manual / monorepo installation
|
### Manual / monorepo installation
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user