Compare commits
2 Commits
02149a10da
...
1162ed8899
Author | SHA1 | Date |
---|---|---|
perl | 1162ed8899 | |
perl | 1c51fd54ab |
|
@ -0,0 +1,12 @@
|
||||||
|
FROM nginx:stable-alpine
|
||||||
|
COPY --chmod=0440 ["./locations", "/etc/nginx/locations"]
|
||||||
|
COPY --chmod=0440 ["./configuration", "/etc/nginx/configuration"]
|
||||||
|
COPY --chmod=0440 ["./error-pages", "/etc/nginx/error-pages"]
|
||||||
|
COPY --chmod=0440 ["./resources", "/var/www/html/resources"]
|
||||||
|
COPY --chmod=0440 ["./resources", "/var/www/html/resources"]
|
||||||
|
COPY --chmod=0440 ["./nginx_configs/nginx.conf", "/etc/nginx/nginx.conf"]
|
||||||
|
|
||||||
|
ARG CONT_IMG_VER
|
||||||
|
ENV CONT_IMG_VER=${CONT_IMG_VER:-v1.0.0}
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -2,17 +2,16 @@
|
||||||
#ARGS: SERVER_NAMES, CERT_FILE, CERT_KEY_FILE, CONT_IMG_VER
|
#ARGS: SERVER_NAMES, CERT_FILE, CERT_KEY_FILE, CONT_IMG_VER
|
||||||
|
|
||||||
FROM nginx:stable-alpine
|
FROM nginx:stable-alpine
|
||||||
|
USER nginx
|
||||||
|
EXPOSE 80 443
|
||||||
|
|
||||||
#http to https redirect
|
#static site + http to https redirect server
|
||||||
COPY sites-enabled/http_redirect.conf /etc/nginx/sites-enabled/
|
COPY ./nginx_configs/nginx_static.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
#site config
|
|
||||||
COPY docker_image_configs/static.conf.tmpl /etc/nginx/sites-enabled/static.conf
|
|
||||||
|
|
||||||
#set server name if arg not empty
|
#set server name if arg not empty
|
||||||
ARG SERVER_NAMES
|
ARG SERVER_NAMES
|
||||||
RUN if [ ! -z ${SERVER_NAMES} ]; then \
|
RUN if [ ! -z ${SERVER_NAMES} ]; then \
|
||||||
sed -i "s/server_name _;/server_name $SERVER_NAMES;/g" /etc/nginx/sites-enabled/static.conf ;\
|
sed -i "s/server_name _;/server_name $SERVER_NAMES;/g" /etc/nginx/nginx.conf ;\
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#set certificate file name if arg not empty
|
#set certificate file name if arg not empty
|
||||||
|
|
|
@ -4,3 +4,5 @@ services:
|
||||||
container_name: reverse
|
container_name: reverse
|
||||||
hostname: reverse
|
hostname: reverse
|
||||||
restart: always
|
restart: always
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal=host-gateway"
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#exec 0<data
|
||||||
|
#exec 1>out.log
|
||||||
|
#exec 2>logs/error.log
|
||||||
|
|
||||||
|
root_folder=`pwd`
|
||||||
|
|
||||||
|
menu="
|
||||||
|
[1] up dev reverse
|
||||||
|
[2] restart dev reverse
|
||||||
|
[3] down dev reverse
|
||||||
|
[4] ps dev reverse
|
||||||
|
"
|
||||||
|
input=""
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
echo "$menu"
|
||||||
|
echo -n "Select function № on enter q to exit:\n"
|
||||||
|
read input
|
||||||
|
|
||||||
|
if [ $input = "q" ]
|
||||||
|
then
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$input" in
|
||||||
|
1) docker compose -f docker-compose-devserver.yaml -f docker-compose.limits.yaml up -d;break ;;
|
||||||
|
2) docker compose -f docker-compose-devserver.yaml -f docker-compose.limits.yaml down && \
|
||||||
|
docker compose -f docker-compose-devserver.yaml -f docker-compose.limits.yaml up -d;break ;;
|
||||||
|
3) docker compose -f docker-compose-devserver.yaml -f docker-compose.limits.yaml down;break ;;
|
||||||
|
4) docker compose -f docker-compose-devserver.yaml -f docker-compose.limits.yaml ps;break ;;
|
||||||
|
*) echo "key not found"
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "end of the script"
|
|
@ -0,0 +1,38 @@
|
||||||
|
name: reverse_dev
|
||||||
|
include:
|
||||||
|
- path:
|
||||||
|
- compose_extends/network.include.yaml
|
||||||
|
|
||||||
|
services:
|
||||||
|
reverse:
|
||||||
|
extends:
|
||||||
|
file: compose_extends/docker-compose.base.yaml
|
||||||
|
service: reverse
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfiles/Dockerfile_devserver
|
||||||
|
args:
|
||||||
|
CONT_IMG_VER: "v1.0.0"
|
||||||
|
pull_policy: missing
|
||||||
|
volumes:
|
||||||
|
- "./sites-enabled:/etc/nginx/sites-enabled:ro"
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
networks:
|
||||||
|
- services
|
||||||
|
secrets:
|
||||||
|
- source: softsols_cert
|
||||||
|
target: /etc/nginx/ssl/live/softsols.ru/fullchain.pem
|
||||||
|
- source: softsols_key
|
||||||
|
target: /etc/nginx/ssl/live/softsols.ru/privkey.pem
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
softsols_cert:
|
||||||
|
name: softsols_cert
|
||||||
|
file: ./ssl/live/softsols.ru/fullchain.pem
|
||||||
|
external: false
|
||||||
|
softsols_key:
|
||||||
|
name: softsols_key
|
||||||
|
file: ./ssl/live/softsols.ru/privkey.pem
|
||||||
|
external: false
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: nginx_static
|
||||||
|
include:
|
||||||
|
- path:
|
||||||
|
- compose_extends/network.include.yaml
|
||||||
|
|
||||||
|
services:
|
||||||
|
static_site:
|
||||||
|
extends:
|
||||||
|
file: compose_extends/docker-compose.base.yaml
|
||||||
|
service: reverse
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfiles/Dockerfile_staticsite
|
||||||
|
args:
|
||||||
|
CONT_IMG_VER: "v1.0.0"
|
||||||
|
volumes:
|
||||||
|
- "./ssl:/etc/nginx/ssl:ro"
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
networks:
|
||||||
|
- services
|
|
@ -1,3 +1,4 @@
|
||||||
|
name: reverse_default
|
||||||
include:
|
include:
|
||||||
- path:
|
- path:
|
||||||
- compose_extends/network.include.yaml
|
- compose_extends/network.include.yaml
|
||||||
|
@ -7,10 +8,7 @@ services:
|
||||||
extends:
|
extends:
|
||||||
file: compose_extends/docker-compose.base.yaml
|
file: compose_extends/docker-compose.base.yaml
|
||||||
service: reverse
|
service: reverse
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal=host-gateway"
|
|
||||||
volumes:
|
volumes:
|
||||||
- "./nginx.conf:/etc/nginx/nginx.conf:ro"
|
|
||||||
- "./locations:/etc/nginx/locations:ro"
|
- "./locations:/etc/nginx/locations:ro"
|
||||||
- "./configuration:/etc/nginx/configuration:ro"
|
- "./configuration:/etc/nginx/configuration:ro"
|
||||||
- "./sites-enabled:/etc/nginx/sites-enabled:ro"
|
- "./sites-enabled:/etc/nginx/sites-enabled:ro"
|
||||||
|
@ -22,4 +20,13 @@ services:
|
||||||
- 80:80
|
- 80:80
|
||||||
- 443:443
|
- 443:443
|
||||||
networks:
|
networks:
|
||||||
- services
|
- services
|
||||||
|
configs:
|
||||||
|
- source: nginx_config
|
||||||
|
target: /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
configs:
|
||||||
|
nginx_config:
|
||||||
|
name: times_new_nginx_config
|
||||||
|
file: ./nginx_config/nginx.conf
|
||||||
|
external: false
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
server {
|
|
||||||
listen 443 ssl;
|
|
||||||
listen [::]:443 ssl;
|
|
||||||
http2 on;
|
|
||||||
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
ssl_certificate /etc/nginx/ssl/cert.pem;
|
|
||||||
ssl_certificate_key /etc/nginx/ssl/key.pem;
|
|
||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
|
||||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
include configuration/_includes.conf;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /var/www/html/;
|
|
||||||
index index.html;
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
user nobody nogroup;
|
||||||
|
worker_processes auto;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
include /etc/nginx/modules-enabled/*.conf;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
|
client_max_body_size 16M;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log debug;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
include /etc/nginx/sites-enabled/*.conf;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name _;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
http2 on;
|
||||||
|
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/ssl/cert.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/ssl/key.pem;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
include configuration/_includes.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /var/www/html/;
|
||||||
|
index index.html;
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue