@@ -159,7 +159,8 @@ RUN mkdir -p /opt/app-root/extensions-temp && \
159159 code-server --install-extension /opt/app-root/bin/utils/ms-toolsai.jupyter-2025.2.0.vsix --extensions-dir /opt/app-root/extensions-temp
160160
161161# Install NGINX to proxy code-server and pass probes check
162- ENV NGINX_VERSION=1.24 \
162+ ENV APP_ROOT=/opt/app-root \
163+ NGINX_VERSION=1.24 \
163164 NGINX_SHORT_VER=124 \
164165 NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \
165166 NGINX_CONF_PATH=/etc/nginx/nginx.conf \
@@ -170,17 +171,23 @@ ENV NGINX_VERSION=1.24 \
170171 NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl
171172
172173# Modules does not exist
173- RUN dnf install -y https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
174- INSTALL_PKGS="bind-utils nginx nginx-mod-stream nginx-mod-http-perl fcgiwrap initscripts chkconfig supervisor" && \
174+ RUN INSTALL_PKGS="bind-utils nginx nginx-mod-stream nginx-mod-http-perl httpd" && \
175175 dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
176176 rpm -V $INSTALL_PKGS && \
177177 dnf -y clean all --enablerepo='*'
178178
179- COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
179+ # Configure httpd for CGI processing
180+ COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/httpd/httpd.conf /etc/httpd/conf/httpd.conf
181+ COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/httpd/codeserver-cgi.conf /etc/httpd/conf.d/codeserver-cgi.conf
180182
181183# Copy extra files to the image.
182184COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/nginx/root/ /
183185
186+ ## Configure nginx
187+ COPY ${CODESERVER_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
188+ COPY ${CODESERVER_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
189+ COPY ${CODESERVER_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
190+
184191# Changing ownership and user rights to support following use-cases:
185192# 1) running container on OpenShift, whose default security model
186193# is to run the container under random UID, but GID=0
@@ -199,14 +206,20 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
199206 mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
200207 mkdir -p ${NGINX_LOG_PATH} && \
201208 mkdir -p ${NGINX_PERL_MODULE_PATH} && \
209+ # Create httpd directories and set permissions
210+ mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
202211 chown -R 1001:0 ${NGINX_CONF_PATH} && \
203212 chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \
204213 chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
205214 chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \
215+ chown -R 1001:0 /var/log/httpd /var/run/httpd /etc/httpd/logs && \
206216 chmod ug+rw ${NGINX_CONF_PATH} && \
207217 chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \
208218 chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
209219 chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
220+ chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
221+ # Make CGI script executable
222+ chmod +x /opt/app-root/api/kernels/access.cgi && \
210223 rpm-file-permissions && \
211224 # Ensure the temporary directory and target directory have the correct permissions
212225 mkdir -p /opt/app-root/src/.local/share/code-server/extensions && \
@@ -215,11 +228,6 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
215228 chown -R 1001:0 /opt/app-root/extensions-temp && \
216229 chown -R 1001:0 /opt/app-root/src/.config/code-server
217230
218- ## Configure nginx
219- COPY ${CODESERVER_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
220- COPY ${CODESERVER_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
221- COPY ${CODESERVER_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
222-
223231# Launcher
224232COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/run-code-server.sh ${CODESERVER_SOURCE_CODE}/run-nginx.sh ./
225233
0 commit comments