mirror of
https://github.com/fcwu/docker-ubuntu-vnc-desktop
synced 2025-12-06 08:22:31 +01:00
Add rename URL script to update nginx config with prefix path ENV
This commit is contained in:
parent
f48e7551f4
commit
b0ece0637c
2 changed files with 22 additions and 0 deletions
|
|
@ -112,6 +112,9 @@ RUN cp -R /src/web/dist/. /usr/local/lib/web/frontend/
|
|||
|
||||
COPY image /
|
||||
|
||||
# This has to be called in deriving images
|
||||
RUN python /etc/RenameURL.py
|
||||
|
||||
EXPOSE 80
|
||||
WORKDIR /root
|
||||
ENV HOME=/home/ubuntu \
|
||||
|
|
|
|||
19
image/etc/RenameURL.py
Normal file
19
image/etc/RenameURL.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import os, fnmatch
|
||||
|
||||
toFind = "/app"
|
||||
toReplace = os.getenv("PREFIX_PATH", "/app")
|
||||
|
||||
print("using path {0} ...".format(toReplace))
|
||||
|
||||
def findReplace(directory, find, replace):
|
||||
print("Rename {0} into {1} at {2}".format(toFind, toReplace, directory))
|
||||
for path, dirs, files in os.walk(os.path.abspath(directory)):
|
||||
for filename in files:
|
||||
filepath = os.path.join(path, filename)
|
||||
with open(filepath) as f:
|
||||
s = f.read()
|
||||
s = s.replace(find, replace)
|
||||
with open(filepath, "w") as f:
|
||||
f.write(s)
|
||||
|
||||
findReplace("/etc/nginx/sites-enabled/", toFind, toReplace)
|
||||
Loading…
Reference in a new issue