Skip to content

Commit

Permalink
Allow opencost-ui to run with a read-only root filesystem
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Timmer <[email protected]>
  • Loading branch information
kaitimmer committed Feb 9, 2024
1 parent b532e5a commit dbfea70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ ENV API_PORT=9003
ENV API_SERVER=0.0.0.0
ENV UI_PORT=9090

COPY --from=builder /opt/ui/dist /var/www
COPY --from=builder /opt/ui/dist /opt/ui/dist
RUN mkdir -p /var/www
COPY default.nginx.conf.template /etc/nginx/conf.d/default.nginx.conf.template
COPY nginx.conf /etc/nginx/
COPY ./docker-entrypoint.sh /usr/local/bin/
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ ENV API_PORT=9003
ENV API_SERVER=0.0.0.0
ENV UI_PORT=9090

COPY ./dist /var/www
COPY ./dist /opt/ui/dist
COPY default.nginx.conf.template /etc/nginx/conf.d/default.nginx.conf.template
COPY nginx.conf /etc/nginx/
COPY ./docker-entrypoint.sh /usr/local/bin/
RUN mkdir -p /var/www

RUN rm -rf /etc/nginx/conf.d/default.conf

Expand Down
2 changes: 2 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh
set -e

cp -rv /opt/ui/dist/* /var/www

if [[ ! -z "$BASE_URL_OVERRIDE" ]]; then
echo "running with BASE_URL=${BASE_URL_OVERRIDE}"
sed -i "s^{PLACEHOLDER_BASE_URL}^$BASE_URL_OVERRIDE^g" /var/www/*.js
Expand Down

0 comments on commit dbfea70

Please sign in to comment.