feat: build and run custom nginx container (#3155)

### Description

This replaces the volume mount that shared PHP code between the nginx
and legacy containers with a custom nginx image that has the code baked
in from build. I would have preferred to find a solution that did not
require this, but it looks like docker volumes do not support temporary
volumes that only last the lifetime of the container.

**This is a new feature**:

No

**I have updated the documentation to reflect these changes**:

N/A

### Testing Notes

**What I did:**

Tested with docker-compose

**How you can replicate my testing:**

Run the docker-compose setup

### **Links**

Closes: #3150

---------

Co-authored-by: jo <ljonas@riseup.net>
This commit is contained in:
Kyle Robbertze 2025-05-29 16:04:17 +01:00 committed by GitHub
parent 34cd5f8772
commit 658ce15185
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 6 deletions

View File

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
target: [analyzer, api, legacy, playout, worker] target: [analyzer, api, legacy, nginx, playout, worker]
if: ${{ github.repository_owner == 'libretime' }} if: ${{ github.repository_owner == 'libretime' }}
steps: steps:
@ -95,6 +95,7 @@ jobs:
meta-analyzer/docker-metadata-action-bake.json meta-analyzer/docker-metadata-action-bake.json
meta-api/docker-metadata-action-bake.json meta-api/docker-metadata-action-bake.json
meta-legacy/docker-metadata-action-bake.json meta-legacy/docker-metadata-action-bake.json
meta-nginx/docker-metadata-action-bake.json
meta-playout/docker-metadata-action-bake.json meta-playout/docker-metadata-action-bake.json
meta-worker/docker-metadata-action-bake.json meta-worker/docker-metadata-action-bake.json
set: | set: |

View File

@ -278,3 +278,13 @@ USER ${UID}:${GID}
ARG LIBRETIME_VERSION ARG LIBRETIME_VERSION
ENV LIBRETIME_VERSION=$LIBRETIME_VERSION ENV LIBRETIME_VERSION=$LIBRETIME_VERSION
#======================================================================================#
# Nginx
#======================================================================================#
FROM nginx AS libretime-nginx
COPY --from=libretime-legacy /var/www/html /var/www/html
ARG LIBRETIME_VERSION
ENV LIBRETIME_VERSION=$LIBRETIME_VERSION

View File

@ -1,7 +1,7 @@
{ {
"group": { "group": {
"default": { "default": {
"targets": ["analyzer", "playout", "api", "worker", "legacy"] "targets": ["analyzer", "playout", "api", "worker", "legacy", "nginx"]
} }
}, },
"target": { "target": {
@ -19,6 +19,9 @@
}, },
"legacy": { "legacy": {
"target": "libretime-legacy" "target": "libretime-legacy"
},
"nginx": {
"target": "libretime-nginx"
} }
} }
} }

View File

@ -67,6 +67,9 @@ services:
- ./legacy:/var/www/html - ./legacy:/var/www/html
nginx: nginx:
build:
context: .
target: libretime-nginx
volumes: volumes:
- ./legacy:/var/www/html - ./legacy:/var/www/html

View File

@ -95,17 +95,15 @@ services:
- rabbitmq - rabbitmq
volumes: volumes:
- ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro - ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
- libretime_assets:/var/www/html
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
nginx: nginx:
image: nginx image: ghcr.io/libretime/libretime-nginx:${LIBRETIME_VERSION:-latest}
ports: ports:
- 8080:8080 - 8080:8080
depends_on: depends_on:
- legacy - legacy
volumes: volumes:
- libretime_assets:/var/www/html:ro
- libretime_storage:/srv/libretime:ro - libretime_storage:/srv/libretime:ro
- ${NGINX_CONFIG_FILEPATH:-./nginx.conf}:/etc/nginx/conf.d/default.conf:ro - ${NGINX_CONFIG_FILEPATH:-./nginx.conf}:/etc/nginx/conf.d/default.conf:ro
@ -121,5 +119,4 @@ services:
volumes: volumes:
postgres_data: {} postgres_data: {}
libretime_storage: {} libretime_storage: {}
libretime_assets: {}
libretime_playout: {} libretime_playout: {}