Skip to content

Commit d58d320

Browse files
authored
Support parametrization of nginx port (opea-project#1456)
Signed-off-by: ZePan110 <[email protected]>
1 parent 78b94fc commit d58d320

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

comps/third_parties/nginx/deployment/docker_compose/start-nginx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
#!/bin/sh
5-
envsubst '${FRONTEND_SERVICE_IP} ${FRONTEND_SERVICE_PORT} ${BACKEND_SERVICE_NAME} ${BACKEND_SERVICE_IP} ${BACKEND_SERVICE_PORT} ${DATAPREP_SERVICE_IP} ${DATAPREP_SERVICE_PORT}' < /etc/nginx/nginx.conf.template > /etc/nginx/conf.d/default.conf
5+
envsubst '${NGINX_PORT} ${FRONTEND_SERVICE_IP} ${FRONTEND_SERVICE_PORT} ${BACKEND_SERVICE_NAME} ${BACKEND_SERVICE_IP} ${BACKEND_SERVICE_PORT} ${DATAPREP_SERVICE_IP} ${DATAPREP_SERVICE_PORT}' < /etc/nginx/nginx.conf.template > /etc/nginx/conf.d/default.conf
66
nginx -g 'daemon off;'

comps/third_parties/nginx/src/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44

5-
FROM nginx:alpine
6-
7-
RUN apk add --no-cache gettext
5+
FROM nginxinc/nginx-unprivileged
6+
USER root
7+
RUN apt-get update && apt-get install -y gettext && apt-get clean
8+
#RUN apk add --no-cache gettext
89

910
COPY comps/third_parties/nginx/src/nginx.conf.template /etc/nginx/nginx.conf.template
1011

12+
ENV NGINX_PORT=8080
1113
ENV FRONTEND_SERVICE_IP=localhost
1214
ENV FRONTEND_SERVICE_PORT=5173
1315
ENV BACKEND_SERVICE_NAME=chatqna

comps/third_parties/nginx/src/nginx.conf.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44

55
server {
6-
listen 80;
7-
listen [::]:80;
6+
listen ${NGINX_PORT};
7+
listen [::]:${NGINX_PORT};
88

99
location /home {
1010
alias /usr/share/nginx/html/index.html;

tests/third_parties/test_third_parties_nginx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function start_service() {
2323
export NGINX_PORT=80
2424

2525
# Start Docker Containers
26-
docker run -d --name test-comps-nginx-server -p 80:80 opea/nginx:comps
26+
docker run -d --name test-comps-nginx-server -p ${NGINX_PORT}:8080 -e NGINX_PORT=8080 opea/nginx:comps
2727

2828
sleep 5s
2929
}

0 commit comments

Comments
 (0)