This commit is contained in:
parent
43ee84912e
commit
1ab8bb7c4e
@ -4,7 +4,7 @@ pipeline:
|
|||||||
commands:
|
commands:
|
||||||
- echo -n "${CI_COMMIT_BRANCH//\//-}-${CI_COMMIT_SHA:0:8}, latest" > .tags
|
- echo -n "${CI_COMMIT_BRANCH//\//-}-${CI_COMMIT_SHA:0:8}, latest" > .tags
|
||||||
when:
|
when:
|
||||||
path: [ "frontend/**", "backend/**" ]
|
path: [ "frontend/**", "backend/**", "proxy/**" ]
|
||||||
event: push
|
event: push
|
||||||
|
|
||||||
|
|
||||||
@ -45,4 +45,22 @@ pipeline:
|
|||||||
path: "frontend/**"
|
path: "frontend/**"
|
||||||
event: push
|
event: push
|
||||||
|
|
||||||
|
# -------------------------------------- Frontend --------------------------------------
|
||||||
|
build_proxy:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
repo:
|
||||||
|
from_secret: repository_proxy
|
||||||
|
username:
|
||||||
|
from_secret: registry_username
|
||||||
|
password:
|
||||||
|
from_secret: registry_password
|
||||||
|
registry:
|
||||||
|
from_secret: registry
|
||||||
|
dockerfile: Dockerfile.Proxy
|
||||||
|
platforms: linux/amd64
|
||||||
|
when:
|
||||||
|
path: "proxy/**"
|
||||||
|
event: push
|
||||||
|
|
||||||
branches: main
|
branches: main
|
||||||
|
24
Dockerfile.Proxy
Normal file
24
Dockerfile.Proxy
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Base image
|
||||||
|
FROM nginx
|
||||||
|
|
||||||
|
ENV DOMAIN=translator.dhbw.flokaiser.com
|
||||||
|
ENV EMAIL=inf20155@lehre.dhbw-stuttgart.de
|
||||||
|
|
||||||
|
# Install necessary packages
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y certbot python-certbot-nginx
|
||||||
|
|
||||||
|
# Generate SSL certificates using Let's Encrypt
|
||||||
|
RUN certbot certonly --standalone --preferred-challenges http -d ${DOMAIN} -n -m ${EMAIL} --agree-tos --force-renewal && \
|
||||||
|
ln -s /etc/letsencrypt/live/${DOMAIN}/fullchain.pem /etc/nginx/certs/cert.pem && \
|
||||||
|
ln -s /etc/letsencrypt/live/${Domain}/privkey.pem /etc/nginx/certs/key.pem
|
||||||
|
|
||||||
|
# Copy NGINX configuration file
|
||||||
|
COPY ./proxy/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
# Expose port 80 and 443
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
|
# Start NGINX
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
42
proxy/nginx.conf
Normal file
42
proxy/nginx.conf
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
# HTTPS server configuration
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name translator.dhbw.flokaiser.com;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/certs/cert.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/certs/key.pem;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# Forward requests to port 80
|
||||||
|
proxy_pass http://frontend:80/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api {
|
||||||
|
# Forward requests to port 80
|
||||||
|
proxy_pass http://backend:80/api/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# HTTP server configuration
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name translator.dhbw.flokaiser.com;
|
||||||
|
|
||||||
|
return 301 https://$server_name$request_uri;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user