add docker registry

This commit is contained in:
2024-11-12 13:29:11 +03:00
parent 83db524396
commit a13e66b007
5 changed files with 574 additions and 434 deletions

50
docker/Dockerfile Normal file
View File

@@ -0,0 +1,50 @@
## syntax=docker/dockerfile:3
FROM bitnami/nginx:1.22-debian-11
SHELL ["/bin/bash", "-eux", "-c"]
LABEL name="BitDeals WebUI"
EXPOSE 80/tcp
## Debian update; install dependencies
ARG DEBIAN_FRONTEND=noninteractive \
DEBCONF_NOWARNINGS="yes"
USER root
RUN apt-get update -y ; \
apt-get upgrade -y ; \
apt-get -y install --no-install-recommends locales tzdata moreutils ; \
apt-get clean ; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --chown=www-data:www-data ./build .
COPY ./docker/nginx.conf /opt/bitnami/nginx/conf/server_blocks/nginx.conf
ENV WEB_CONF_FILE="/app/config.js"
ENV BD_FORWEB="http://127.0.0.1:80"
ENV BD_WEB_LANG="en"
SHELL ["/bin/bash", "-eu", "-c"]
# Change default variables in config file
RUN sed -i -e "/creditsText:/ s/20../$(date +%Y)/" \
-e 's/confAuthorize:.*/confAuthorize: true,/' \
-e 's/dmHost:.*/dmHost: "http:\/\/0.0.0.0:4999",/' \
-e 's/confPrivateDash:.*/confPrivateDash: true,/' \
-e 's/confDealModule:.*/confDealModule: false,/' \
-e 's/confAdmin:.*/confAdmin: true,/' $WEB_CONF_FILE
RUN chmod 666 $WEB_CONF_FILE
USER 1001
# Confugure BitDeals WebUI
CMD cat $WEB_CONF_FILE | \
sed -e "s|defaultLanguage:.*|defaultLanguage: \"$BD_WEB_LANG\",|" \
-e "s|apiTokenUrl:.*|apiTokenUrl: \"$BD_FORWEB/oauth2/token\",|" \
-e "s|apiDomain:.*|apiDomain: \"$BD_FORWEB\",|" \
-e "s|wsDomain:.*|wsDomain: \"wss://$(basename $BD_FORWEB)\",|" | \
sponge $WEB_CONF_FILE ;\
/opt/bitnami/scripts/nginx/run.sh

78
docker/nginx.conf Normal file
View File

@@ -0,0 +1,78 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
index index.html;
server_name _;
location ^~ /docs/ {
proxy_pass http://bitdeals:4977;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "close";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~ /oauth2/ {
proxy_pass http://bitdeals:4977;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "close";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~ /oauth/ {
proxy_pass http://bitdeals:4977;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "close";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~ /api/ {
proxy_pass http://bitdeals:4977;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "close";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~ /ws/ {
proxy_pass http://bitdeals:4977;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "close";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~ /session/ {
proxy_pass http://bitdeals:4977;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
}