diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index de2c015e8..083718760 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -135,9 +135,10 @@ RUN yarn build FROM nginx:1.23.4 as lowcoder-ce-frontend LABEL maintainer="lowcoder" -# Change default nginx user into lowcoder user +# Change default nginx user into lowcoder user and remove default nginx config RUN usermod --login lowcoder --uid 9001 nginx \ - && groupmod --new-name lowcoder --gid 9001 nginx + && groupmod --new-name lowcoder --gid 9001 nginx \ + && rm -f /etc/nginx/nginx.conf # Copy lowcoder client data COPY --chown=lowcoder:lowcoder --from=build-client /lowcoder-client/packages/lowcoder/build/ /lowcoder/client diff --git a/deploy/docker/all-in-one/entrypoint.sh b/deploy/docker/all-in-one/entrypoint.sh index 041f0401e..7352833cc 100644 --- a/deploy/docker/all-in-one/entrypoint.sh +++ b/deploy/docker/all-in-one/entrypoint.sh @@ -66,19 +66,6 @@ fi; # Enable frontend if configured to run if [ "${FRONTEND_ENABLED:=true}" = "true" ]; then ln ${SUPERVISOR_AVAILABLE}/20-frontend.conf ${SUPERVISOR_ENABLED}/20-frontend.conf - - unlink /etc/nginx/nginx.conf 2>/dev/null - if [ -e "${CERT}/fullchain.pem" ] && [ -e "${CERT}/privkey.pem" ]; then - echo "Certificates found, starting with HTTPS." - ln -s /etc/nginx/nginx-https.conf /etc/nginx/nginx.conf - if [ ! -e "${CERT}/dhparam.pem" ]; then - echo "Diffle-Helmann parameters file not found, generating in now... (this can take some time)" - openssl dhparam -out "${CERT}/dhparam.pem" 4096 - fi; - else - echo "Certificates not found, starting with HTTP." - ln -s /etc/nginx/nginx-http.conf /etc/nginx/nginx.conf - fi; fi; # Handle CMD command diff --git a/deploy/docker/frontend/01-update-nginx-conf.sh b/deploy/docker/frontend/01-update-nginx-conf.sh index 1e1e3c1e7..014aaf099 100644 --- a/deploy/docker/frontend/01-update-nginx-conf.sh +++ b/deploy/docker/frontend/01-update-nginx-conf.sh @@ -2,6 +2,19 @@ set -e +echo "Creating nginx config..." +if [ -e "${CERT}/fullchain.pem" ] && [ -e "${CERT}/privkey.pem" ]; then + echo "Certificates found, configuring with HTTPS." + ln -s /etc/nginx/nginx-https.conf /etc/nginx/nginx.conf + if [ ! -e "${CERT}/dhparam.pem" ]; then + echo "Diffle-Helmann parameters file not found, generating in now... (this can take some time)" + openssl dhparam -out "${CERT}/dhparam.pem" 4096 + fi; +else + echo "Certificates not found, configuring with HTTP." + ln -s /etc/nginx/nginx-http.conf /etc/nginx/nginx.conf +fi; + sed -i "s@__LOWCODER_API_SERVICE_URL__@${LOWCODER_API_SERVICE_URL:=http://localhost:8080}@" /etc/nginx/nginx.conf sed -i "s@__LOWCODER_NODE_SERVICE_URL__@${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}@" /etc/nginx/nginx.conf