@@ -30,7 +30,7 @@ USER 1001
3030WORKDIR /opt/app-root/src
3131
3232#####################
33- # rstudio #
33+ # rstudio #
3434#####################
3535FROM base AS rstudio
3636
@@ -117,7 +117,8 @@ COPY ${RSTUDIO_SOURCE_CODE}/rsession.conf /etc/rstudio/rsession.conf
117117RUN R -e "install.packages('Rcpp')"
118118
119119# Install NGINX to proxy RStudio and pass probes check
120- ENV NGINX_VERSION=1.24 \
120+ ENV APP_ROOT=/opt/app-root \
121+ NGINX_VERSION=1.24 \
121122 NGINX_SHORT_VER=124 \
122123 NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \
123124 NGINX_CONF_PATH=/etc/nginx/nginx.conf \
@@ -129,16 +130,23 @@ ENV NGINX_VERSION=1.24 \
129130
130131# Modules does not exist
131132RUN dnf -y module enable nginx:$NGINX_VERSION && \
132- INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl fcgiwrap initscripts chkconfig supervisor " && \
133+ INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl httpd " && \
133134 dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
134135 rpm -V $INSTALL_PKGS && \
135136 nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \
136137 dnf -y clean all --enablerepo='*'
137138
138- COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
139+ # Configure httpd for CGI processing
140+ COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/httpd.conf /etc/httpd/conf/httpd.conf
141+ COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/rstudio-cgi.conf /etc/httpd/conf.d/rstudio-cgi.conf
139142
140143# Copy extra files to the image.
141- COPY ${RSTUDIO_SOURCE_CODE}/nginx/root/ /
144+ COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/nginx/root/ /
145+
146+ # Configure nginx
147+ COPY ${RSTUDIO_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
148+ COPY ${RSTUDIO_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
149+ COPY ${RSTUDIO_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
142150
143151# Changing ownership and user rights to support following use-cases:
144152# 1) running container on OpenShift, whose default security model
@@ -158,21 +166,25 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
158166 mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
159167 mkdir -p ${NGINX_LOG_PATH} && \
160168 mkdir -p ${NGINX_PERL_MODULE_PATH} && \
169+ # Create httpd directories and set permissions
170+ mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
161171 chown -R 1001:0 ${NGINX_CONF_PATH} && \
162172 chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \
163173 chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
164174 chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \
175+ # Create httpd directories and set permissions
176+ mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
165177 chmod ug+rw ${NGINX_CONF_PATH} && \
166178 chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \
167179 chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
168180 chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
181+ chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
182+ # Make CGI scripts executable and set proper ownership
183+ chmod +x /opt/app-root/api/kernels/access.cgi && \
184+ chmod +x /opt/app-root/api/probe.cgi && \
185+ chown -R 1001:0 /opt/app-root/api && \
169186 rpm-file-permissions
170187
171- # Configure nginx
172- COPY ${RSTUDIO_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
173- COPY ${RSTUDIO_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
174- COPY ${RSTUDIO_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
175-
176188# Launcher
177189WORKDIR /opt/app-root/bin
178190
0 commit comments