Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: handle DASHBOARD_API_BASE_URL env at docker run time #1231

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ FROM python:3.12-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 \
nginx \
gettext-base \
&& rm -rf /var/lib/apt/lists/*

# Create a non-root user
Expand All @@ -81,6 +82,7 @@ RUN useradd -m -u 1000 -r codegate
# Set permissions for user codegate to run nginx
RUN chown -R codegate /var/lib/nginx && \
chown -R codegate /var/log/nginx && \
chown -R codegate /etc/nginx && \
chown -R codegate /run

COPY nginx.conf /etc/nginx/nginx.conf
Expand Down
7 changes: 3 additions & 4 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ generate_certs() {

# Function to start Nginx server for the dashboard
start_dashboard() {
if [ -n "${DASHBOARD_BASE_URL}" ]; then
echo "Overriding dashboard url with $DASHBOARD_BASE_URL"
sed -ibck "s|http://localhost:8989|http://$DASHBOARD_BASE_URL:8989|g" /var/www/html/assets/*.js
fi
echo "Starting the dashboard..."

envsubst '${DASHBOARD_API_BASE_URL}' < /var/www/html/index.html > /var/www/html/index.html.tmp && mv /var/www/html/index.html.tmp /var/www/html/index.html

nginx -g 'daemon off;' &
}

Expand Down