Skip to content

Commit 959d135

Browse files
authored
Merge pull request #64 from BaseballCardTracker/35-static-files
35 static files
2 parents c137ee0 + 086f0e6 commit 959d135

File tree

6 files changed

+16
-0
lines changed

6 files changed

+16
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/venv/
22
/.idea/
3+
/static/
34
.env
45
*.iml
56
*.sqlite3

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ RUN apt install -y curl
1010

1111
# create user
1212
RUN useradd -ms /bin/bash bbct
13+
RUN mkdir -p /bbct/static
14+
RUN chown -R bbct /bbct
1315
USER bbct
1416

1517
# install poetry

bbct/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,5 @@
137137
# Static files (CSS, JavaScript, Images)
138138
# https://docs.djangoproject.com/en/2.2/howto/static-files/
139139

140+
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
140141
STATIC_URL = '/static/'

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ services:
1010
- db
1111
env_file:
1212
- .env
13+
volumes:
14+
- static_files:/bbct/static
15+
1316
nginx:
1417
build: ./nginx
1518
ports:
1619
- "8000:80"
1720
depends_on:
1821
- api
22+
volumes:
23+
- static_files:/static
24+
1925
db:
2026
image: postgres:13.0-alpine
2127
volumes:
@@ -31,3 +37,4 @@ services:
3137

3238
volumes:
3339
postgres_data:
40+
static_files:

entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ then
1212
fi
1313

1414
poetry run python manage.py migrate
15+
poetry run python manage.py collectstatic
1516

1617
exec "$@"

nginx/nginx.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ server {
66

77
listen 80;
88

9+
location /static {
10+
root /;
11+
}
12+
913
location / {
1014
proxy_pass http://bbct_api;
1115
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

0 commit comments

Comments
 (0)