docker: add customizable port for frontend image (#2147)
This commit is contained in:
parent
121b55231c
commit
9261bc0a6f
2 changed files with 10 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ server {
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
gzip_disable "MSIE [4-6] \.";
|
gzip_disable "MSIE [4-6] \.";
|
||||||
|
|
||||||
listen 80;
|
listen __FRONTEND_PORT__;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,20 @@ trap 'kill -TERM $PID' TERM INT
|
||||||
if [ -z "$BACKEND_URL" ]; then
|
if [ -z "$BACKEND_URL" ]; then
|
||||||
BACKEND_URL="$1"
|
BACKEND_URL="$1"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$FRONTEND_PORT" ]; then
|
||||||
|
FRONTEND_PORT="$2"
|
||||||
|
fi
|
||||||
|
if [ -z "$FRONTEND_PORT" ]; then
|
||||||
|
FRONTEND_PORT="80"
|
||||||
|
fi
|
||||||
if [ -z "$BACKEND_URL" ]; then
|
if [ -z "$BACKEND_URL" ]; then
|
||||||
echo "BACKEND_URL must be set as an environment variable or as first parameter. (e.g. http://localhost:7860)"
|
echo "BACKEND_URL must be set as an environment variable or as first parameter. (e.g. http://localhost:7860)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "BACKEND_URL: $BACKEND_URL"
|
||||||
|
echo "FRONTEND_PORT: $FRONTEND_PORT"
|
||||||
sed -i "s|__BACKEND_URL__|$BACKEND_URL|g" /etc/nginx/conf.d/default.conf
|
sed -i "s|__BACKEND_URL__|$BACKEND_URL|g" /etc/nginx/conf.d/default.conf
|
||||||
|
sed -i "s|__FRONTEND_PORT__|$FRONTEND_PORT|g" /etc/nginx/conf.d/default.conf
|
||||||
cat /etc/nginx/conf.d/default.conf
|
cat /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue