Skip to content

Commit

Permalink
update docker env
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 6, 2024
1 parent 8df92ed commit 52131fa
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
###########

# pull official base image
FROM python:3.11.4-slim-buster as builder
FROM python:3.11.4-slim-buster AS builder

# set work directory
WORKDIR /usr/src/app
Expand Down
8 changes: 0 additions & 8 deletions auctions/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@
from io import StringIO
from django.core.management import call_command
from .models import *
from channels.testing import HttpCommunicator
from .consumers import LotConsumer
from django.urls import reverse

# class SocketTest(TestCase):
# async def test_my_consumer(self):
# communicator = HttpCommunicator(MyConsumer, "GET", "/test/")
# response = await communicator.get_response()
# self.assertEqual(response["body"], b"test response")
# self.assertEqual(response["status"], 200)

class ViewLotTest(TestCase):
def setUp(self):
time = timezone.now() - datetime.timedelta(days=2)
Expand Down
28 changes: 21 additions & 7 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#version: '3.8'

services:
web:
build: .
Expand Down Expand Up @@ -40,18 +38,34 @@ services:
restart: always
command: redis-server --requirepass ${REDIS_PASSWORD-unsecure}

nginx:
build: ./nginx
swag:
image: lscr.io/linuxserver/swag:latest
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- URL=${SITE_DOMAIN}
- VALIDATION=http
- EMAIL=${ADMIN_EMAIL}
volumes:
- ./swag:/config
- static_volume:/home/app/web/staticfiles
- media_volume:/home/app/web/mediafiles
- ./nginx.conf:/config/nginx/site-confs/default.conf
ports:
- 443:443
- 80:80
restart: unless-stopped
depends_on:
- web
volumes:
- static_volume:/home/app/web/staticfiles
- media_volume:/home/app/web/mediafiles

volumes:
redis_data:
driver: local
mariadb_data:
static_volume:
media_volume:

5 changes: 2 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ if [ "${DEBUG}" = "False" ]; then
exec gunicorn fishauctions.asgi:application -k uvicorn.workers.UvicornWorker -w 8 -b 0.0.0.0:8000
else
echo Starting in development mode, cron jobs must be run manually
python manage.py createsuperuser --username admin --email [email protected] --noinput
uvicorn fishauctions.asgi:application --reload --port 8000
#python manage.py runserver 0.0.0.0:8000
#uvicorn fishauctions.asgi:application --reload --port 8000
python manage.py runserver 0.0.0.0:8000
fi
19 changes: 17 additions & 2 deletions nginx/nginx.conf → nginx.conf
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
upstream fishauctions {
server web:8000;
}
# redirect all traffic to https
server {
listen 80 default_server;
listen [::]:80 default_server;

location / {
return 301 https://$host$request_uri;
}
}

# main server block
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;

server_name _;

listen 80;
include /config/nginx/ssl.conf;

location / {
proxy_pass http://fishauctions;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
client_max_body_size 20M;

}
location /static/ {
alias /home/app/web/staticfiles/;
}
location /media/ {
alias /home/app/web/mediafiles/;
}
}
}
9 changes: 0 additions & 9 deletions nginx/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions nginx/entrypoint.sh

This file was deleted.

Empty file modified update.sh
100644 → 100755
Empty file.

0 comments on commit 52131fa

Please sign in to comment.