feat: add production container publishing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
06b16064f8
commit
fa4091a673
6 changed files with 218 additions and 0 deletions
27
docker/entrypoint.sh
Executable file
27
docker/entrypoint.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
shutdown() {
|
||||
trap - TERM INT
|
||||
kill -TERM "$api_pid" "$nginx_pid" 2>/dev/null || true
|
||||
wait "$api_pid" "$nginx_pid" 2>/dev/null || true
|
||||
exit 0
|
||||
}
|
||||
|
||||
goose -dir /app/migrations postgres "$DATABASE_URL" up
|
||||
seed
|
||||
|
||||
api &
|
||||
api_pid=$!
|
||||
nginx -g 'daemon off;' &
|
||||
nginx_pid=$!
|
||||
|
||||
trap shutdown TERM INT
|
||||
|
||||
while kill -0 "$api_pid" 2>/dev/null && kill -0 "$nginx_pid" 2>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
kill -TERM "$api_pid" "$nginx_pid" 2>/dev/null || true
|
||||
wait "$api_pid" "$nginx_pid" 2>/dev/null || true
|
||||
exit 1
|
||||
44
docker/nginx.conf
Normal file
44
docker/nginx.conf
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
worker_processes auto;
|
||||
pid /tmp/nginx.pid;
|
||||
error_log /dev/stderr warn;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /dev/stdout;
|
||||
sendfile on;
|
||||
|
||||
client_body_temp_path /tmp/nginx/client_body;
|
||||
proxy_temp_path /tmp/nginx/proxy;
|
||||
fastcgi_temp_path /tmp/nginx/fastcgi;
|
||||
uwsgi_temp_path /tmp/nginx/uwsgi;
|
||||
scgi_temp_path /tmp/nginx/scgi;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
|
||||
root /app/frontend;
|
||||
index index.html;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
proxy_http_version 1.1;
|
||||
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 $scheme;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_read_timeout 1h;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue