Skip to content

Commit 84f9d5e

Browse files
committed
feat: add nginx service for static files
1 parent ceb9253 commit 84f9d5e

File tree

134 files changed

+32388
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+32388
-0
lines changed

docker-compose.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: '3'
2+
3+
services:
4+
web:
5+
build: .
6+
container_name: healthtant_web
7+
command: gunicorn config.wsgi:application --bind 0.0.0.0:8000
8+
volumes:
9+
- .:/app
10+
- static_volume:/app/staticfiles
11+
expose:
12+
- 8000
13+
env_file:
14+
- .env
15+
depends_on:
16+
- db
17+
18+
db:
19+
image: postgres:15
20+
container_name: healthtant_db
21+
restart: always
22+
environment:
23+
POSTGRES_DB: healthtant
24+
POSTGRES_USER: healthtant_user
25+
POSTGRES_PASSWORD: healthtant_pass
26+
volumes:
27+
- postgres_data:/var/lib/postgresql/data
28+
29+
nginx:
30+
image: nginx:latest
31+
container_name: healthtant_nginx
32+
ports:
33+
- "80:80"
34+
volumes:
35+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
36+
- static_volume:/app/staticfiles
37+
depends_on:
38+
- web
39+
40+
volumes:
41+
postgres_data:
42+
static_volume:

nginx.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
listen 80;
3+
4+
server_name healthtant.com www.healthtant.com;
5+
6+
location /static/ {
7+
alias /app/staticfiles/;
8+
}
9+
10+
location / {
11+
proxy_pass http://web:8000;
12+
proxy_set_header Host $host;
13+
proxy_set_header X-Real-IP $remote_addr;
14+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
15+
proxy_set_header X-Forwarded-Proto $scheme;
16+
}
17+
}

staticfiles/account/js/account.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(function () {
2+
const allauth = window.allauth = window.allauth || {}
3+
4+
function manageEmailForm (o) {
5+
const actions = document.getElementsByName('action_remove')
6+
if (actions.length) {
7+
actions[0].addEventListener('click', function (e) {
8+
if (!window.confirm(o.i18n.confirmDelete)) {
9+
e.preventDefault()
10+
}
11+
})
12+
}
13+
}
14+
15+
allauth.account = {
16+
forms: {
17+
manageEmailForm
18+
}
19+
}
20+
})()

staticfiles/account/js/onload.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(function () {
2+
document.addEventListener('DOMContentLoaded', function () {
3+
Array.from(document.querySelectorAll('script[data-allauth-onload]')).forEach(scriptElt => {
4+
const funcRef = scriptElt.dataset.allauthOnload
5+
if (typeof funcRef === 'string' && funcRef.startsWith('allauth.')) {
6+
const funcArg = JSON.parse(scriptElt.textContent)
7+
const func = funcRef.split('.').reduce((acc, part) => acc && acc[part], window)
8+
func(funcArg)
9+
}
10+
})
11+
})
12+
})()
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@import url("https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css");
2+
3+
*{
4+
-webkit-font-smoothing: antialiased;
5+
box-sizing: border-box;
6+
}
7+
8+
html,
9+
body {
10+
margin: 0;
11+
height: 100%;
12+
font-family: "inter", Helvetica, Arial, sans-serif;
13+
}
14+
15+
button:focus-visible,
16+
input:focus-visible {
17+
outline: 2px solid #4a90e2;
18+
outline-offset: 2px;
19+
}
20+
21+
a {
22+
text-decoration: none;
23+
color: inherit;
24+
}
25+
26+
input,
27+
button,
28+
textarea,
29+
select {
30+
font: inherit;
31+
}
32+
33+
@media (prefers-reduced-motion: reduce) {
34+
* {
35+
animation-duration: 0.01ms !important;
36+
animation-iteration-count: 1 !important;
37+
transition-duration: 0.01ms !important;
38+
scroll-behavior: auto !important;
39+
}
40+
}

0 commit comments

Comments
 (0)