[extensions-web] docker: substitute $EGO_NODE_ADDRESS at runtime instead of build time
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] docker: substitute $EGO_NODE_ADDRESS at runtime instead of build time
- Date: Fri, 11 Jan 2019 17:44:03 +0000 (UTC)
commit b315cdbb21e8d029be1551f918f72ec1ebdca9d2
Author: Yuri Konotopov <ykonotopov gnome org>
Date: Fri Jan 11 21:10:42 2019 +0400
docker: substitute $EGO_NODE_ADDRESS at runtime instead of build time
openshift/docker/docker-compose.yml | 1 +
openshift/docker/nginx/Dockerfile | 9 +++++----
openshift/templates/extensions-web-nginx.json | 21 ++++++++++++++-------
3 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/openshift/docker/docker-compose.yml b/openshift/docker/docker-compose.yml
index 43abc29..ebe70d4 100644
--- a/openshift/docker/docker-compose.yml
+++ b/openshift/docker/docker-compose.yml
@@ -39,6 +39,7 @@ services:
build:
context: nginx
dockerfile: Dockerfile
+ command: bash -c "envsubst '$$EGO_NODE_ADDRESS' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
&& nginx -g 'daemon off;'"
environment:
EGO_NODE_ADDRESS: extensions-web
restart: always
diff --git a/openshift/docker/nginx/Dockerfile b/openshift/docker/nginx/Dockerfile
index ed8c8f7..8869f5b 100644
--- a/openshift/docker/nginx/Dockerfile
+++ b/openshift/docker/nginx/Dockerfile
@@ -2,13 +2,14 @@ FROM nginx:stable
MAINTAINER Yuri Konotopov <ykonotopov gnome org>
-COPY nginx.conf /tmp
+COPY nginx.conf /etc/nginx/nginx.conf.template
RUN set -ex \
- && envsubst '$EGO_NODE_ADDRESS' < /tmp/nginx.conf > /etc/nginx/nginx.conf \
- && rm /tmp/nginx.conf \
&& mkdir -p /extensions-web/www \
&& chmod g+rwX -R /extensions-web/www \
&& chmod g+rwX -R /var/log/nginx \
&& chmod g+rwX -R /var/cache/nginx \
- && chmod g+rwX -R /var/run
+ && chmod g+rwX -R /var/run \
+ && touch /etc/nginx/nginx.conf \
+ && chmod g+rw /etc/nginx/nginx.conf \
+ && chmod g+rw /etc/nginx/nginx.conf.template
diff --git a/openshift/templates/extensions-web-nginx.json b/openshift/templates/extensions-web-nginx.json
index e77e33b..2e9a01a 100644
--- a/openshift/templates/extensions-web-nginx.json
+++ b/openshift/templates/extensions-web-nginx.json
@@ -267,13 +267,7 @@
"from": {
"kind": "ImageStreamTag",
"name": "nginx:stable"
- },
- "env": [
- {
- "name": "EGO_NODE_ADDRESS",
- "value": "${EGO_NODE_ADDRESS}"
- }
- ]
+ }
}
},
"output": {
@@ -497,6 +491,19 @@
{
"name": "frontend",
"image": "${DEFAULT_DOCKER_REGISTRY}/${NAME}/frontend:latest",
+ "command": [
+ "bash"
+ ],
+ "args": [
+ "-c",
+ "envsubst '$EGO_NODE_ADDRESS' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
&& nginx -g 'daemon off;'"
+ ],
+ "env": [
+ {
+ "name": "EGO_NODE_ADDRESS",
+ "value": "${EGO_NODE_ADDRESS}"
+ }
+ ],
"ports": [
{
"containerPort": 8080
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]