mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: docker nginx script.
This commit is contained in:
1
client/.gitignore
vendored
1
client/.gitignore
vendored
@@ -4,7 +4,6 @@
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
package-lock.json
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
FROM node:14.15.0 as build
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install sudo
|
||||
|
||||
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
|
||||
|
||||
USER docker
|
||||
USER root
|
||||
|
||||
ARG WEB_REVERSE_PROXY_PORT=8000
|
||||
ARG WEB_SSL=false
|
||||
ARG SELF_SIGNED=false
|
||||
ARG NO_DEFAULT=false
|
||||
ARG REACT_APP_SERVICES_HOST=/services/m
|
||||
|
||||
ENV WEB_REVERSE_PROXY_PORT=$WEB_REVERSE_PROXY_PORT
|
||||
ENV WEB_SSL=$WEB_SSL
|
||||
ENV SELF_SIGNED=$SELF_SIGNED
|
||||
ENV NO_DEFAULT=$NO_DEFAULT
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./package.json /app/package.json
|
||||
@@ -22,6 +26,10 @@ RUN npm build
|
||||
|
||||
FROM nginx
|
||||
|
||||
COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY nginx/sites /etc/nginx/templates
|
||||
COPY ./nginx/scripts /root/scripts/
|
||||
# COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
COPY --from=build /app/build /usr/share/nginx/html
|
||||
RUN /bin/bash /root/scripts/build-nginx.sh
|
||||
|
||||
COPY ./build /usr/share/nginx/html
|
||||
|
||||
18
client/nginx/scripts/nginx-build.sh
Normal file
18
client/nginx/scripts/nginx-build.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
for conf in /etc/nginx/templates/*.conf; do
|
||||
mv $conf "/etc/nginx/sites-available/"$(basename $conf) > /dev/null
|
||||
done
|
||||
|
||||
for template in /etc/nginx/templates/*.template; do
|
||||
envsubst < $template > "/etc/nginx/sites-available/"$(basename $template)".conf"
|
||||
done
|
||||
|
||||
if [[ "$NO_DEFAULT" = true ]]; then
|
||||
rm /etc/nginx/sites-available/node.template.conf
|
||||
rm /etc/nginx/sites-available/node-https.template.conf
|
||||
else
|
||||
if [[ "$WEB_SSL" = false ]]; then
|
||||
rm /etc/nginx/sites-available/node-https.template.conf
|
||||
fi
|
||||
fi
|
||||
13
client/nginx/sites/node-https.template
Normal file
13
client/nginx/sites/node-https.template
Normal file
@@ -0,0 +1,13 @@
|
||||
# environment variables
|
||||
# WEB_REVERSE_PROXY_PORT ${WEB_REVERSE_PROXY_PORT}
|
||||
server {
|
||||
listen 443 default_server http2;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/cert1.pem;
|
||||
ssl_certificate_key /etc/ssl/privkey1.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://node:${WEB_REVERSE_PROXY_PORT};
|
||||
}
|
||||
}
|
||||
14
client/nginx/sites/node.template
Normal file
14
client/nginx/sites/node.template
Normal file
@@ -0,0 +1,14 @@
|
||||
# environment variables
|
||||
# WEB_REVERSE_PROXY_PORT ${WEB_REVERSE_PROXY_PORT}
|
||||
server {
|
||||
listen 80 default_server;
|
||||
|
||||
location / {
|
||||
proxy_pass http://node:${WEB_REVERSE_PROXY_PORT};
|
||||
}
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/letsencrypt/;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
||||
17658
client/package-lock.json
generated
Normal file
17658
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user