-
Notifications
You must be signed in to change notification settings - Fork 173
FLOOD_BASE_URI does not work in Docker image #621
Comments
I think you need to modify the config file in the container itself. Start by updating the config.docker.js file to include support for getting the new base URI from environment variables. |
Make sure the baseURI = '/flood/' in config.js Also you should not need the proxy_set_header stuff, nor the additional /flood/ on the proxy_pass portion (ie should just be proxy_pass http://localhost:10660) |
config.docker.js contains this
When I run docker setting |
i've been able to confirm that it's due to the static content not being regenerated since the container build process. if you run |
Great detective work. Is there a better general approach to this in Docker? |
the
|
It turns out that the reason for this is that there's no direct way of passing environment variables to a container during the build process. The workaround is to specify the variable as an I modified my Dockerfile like this: @@ -18,7 +18,12 @@ RUN apk add --no-cache --virtual=build-dependencies \
# Build static assets and remove devDependencies.
COPY client ./client
COPY shared ./shared
COPY config.docker.js ./config.js
+
+ARG FLOOD_BASE_URI=/
+ENV FLOOD_BASE_URI $FLOOD_BASE_URI
+
RUN npm run build && \
npm prune --production
COPY server ./server Now you can pass the setting using # <snip>
build:
context: ./flood/
args:
- FLOOD_BASE_URI=/flood/ I'd suggest something to this effect gets added to the Dockerfile and wiki. |
I am trying to run flood, using the provided Dockerfile, behind a nginx reverse proxy.
In my docker-compose file I pass the environment variable
FLOOD_BASE_URI = /flood
to the container. I have even checked usingdocker exec
to make sure this variable is actually passed.When accessing
http://192.168.1.200/flood
from a browser returns a blank, dark blue page.Viewing the source of the page reveals the problem:
<script src="/static/js/main.3cee5571.js" type="text/javascript"></script>
Of course, the URL should be
/flood/static/js/main.3cee5571.js
, so it seems that flood is not properly using the baseURI variable in generating the page.Testing further:
wget http://192.168.1.200/static/js/main.3cee5571.js
returns a 404 error, as expectedwget http://192.168.1.200/flood/static/js/main.3cee5571.js
works and returns a javascript file. So this seems to indicate to me that nginx is not the issue, as it is forwarding URLs correctly when properly formattedSurprisingly, bypassing the proxy by accessing
http://192.168.1.200:3000/
still gives a fully functional flood page, even with the baseURI variable set to '/flood', andhttp://192.168.1.200:3000/flood
still does not work. Again, this seems to me an issue with flood not handling the baseURI variable properly, instead of an issue with the reverse proxy configuration.Here's my nginx proxy configuration
I also tried running without the
proxy_set_header
commands with no luck.Your Environment
The text was updated successfully, but these errors were encountered: