Partial working docker image
This commit is contained in:
4
one_trip/.gitignore
vendored
4
one_trip/.gitignore
vendored
@@ -42,3 +42,7 @@ app.*.map.json
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
OneTrip.AppDir
|
||||
AppRun
|
||||
**.AppImage
|
||||
|
||||
8
one_trip/OneTrip.desktop
Normal file
8
one_trip/OneTrip.desktop
Normal file
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Name=One Trip
|
||||
Exec=one_trip %u
|
||||
Icon=desktop
|
||||
Categories=Utility;
|
||||
6
one_trip_api/.dockerignore
Normal file
6
one_trip_api/.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
**/.git
|
||||
**/dev_data
|
||||
**/prod_data
|
||||
**/venv
|
||||
**/__pycache__
|
||||
**/db.sqlite3
|
||||
2
one_trip_api/.gitignore
vendored
2
one_trip_api/.gitignore
vendored
@@ -9,7 +9,7 @@ __pycache__/
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
media
|
||||
dev_data/
|
||||
|
||||
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
|
||||
# in your Git repository. Update and uncomment the following line accordingly.
|
||||
|
||||
41
one_trip_api/Dockerfile
Normal file
41
one_trip_api/Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set up user
|
||||
ARG UID
|
||||
ARG GID
|
||||
RUN useradd --system --uid ${UID} --gid ${GID} --create-home --shell /bin/bash groceries
|
||||
RUN usermod -aG ${GID} groceries
|
||||
|
||||
ARG DEBIAN_FRONTEND="noninteractive"
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV DJANGO_RELEASE=1
|
||||
|
||||
# Set up directories
|
||||
ENV HOME=/home/groceries
|
||||
ENV APP_DIR=${HOME}/web
|
||||
ENV DATA_DIR=${HOME}/data
|
||||
|
||||
RUN mkdir -p ${APP_DIR}
|
||||
RUN mkdir -p ${DATA_DIR}
|
||||
|
||||
WORKDIR ${APP_DIR}
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install --yes --no-install-recommends nano curl
|
||||
|
||||
# Build pip requirements
|
||||
ADD ./requirements.txt .
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# Copy files
|
||||
ADD . ${APP_DIR}
|
||||
RUN chown -R ${UID}:${GID} ${HOME}
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
USER groceries
|
||||
|
||||
ENTRYPOINT [ "/home/groceries/web/entrypoint.sh" ]
|
||||
|
||||
|
||||
20
one_trip_api/docker-compose.yaml
Normal file
20
one_trip_api/docker-compose.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
services:
|
||||
groceries:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- UID=999
|
||||
- GID=33
|
||||
ports:
|
||||
- 8001:8080
|
||||
volumes:
|
||||
- /var/www/groceries.alaevens.ca/data:/home/groceries/data:rw
|
||||
- type: bind
|
||||
source: /var/www/groceries.alaevens.ca/db.sqlite3
|
||||
target: /home/groceries/web/db.sqlite3
|
||||
|
||||
redis:
|
||||
image: "redis:alpine"
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
5
one_trip_api/entrypoint.sh
Normal file
5
one_trip_api/entrypoint.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#! /bin/bash
|
||||
python3 manage.py makemigrations
|
||||
python3 manage.py migrate
|
||||
python3 manage.py collectstatic --no-input
|
||||
gunicorn one_trip_api.asgi:application -b 0.0.0.0:8080 --access-logfile - -k uvicorn.workers.UvicornWorker
|
||||
@@ -14,7 +14,7 @@ from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
STATIC_URL = "static/"
|
||||
STATIC_URL = "/static/"
|
||||
MEDIA_URL = "/media/"
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ INSTALLED_APPS = [
|
||||
'api',
|
||||
'users',
|
||||
'ws',
|
||||
'daphne',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
@@ -83,7 +82,7 @@ CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [("127.0.0.1", 6379)],
|
||||
"hosts": [("redis", 6379)],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ DEBUG = True
|
||||
|
||||
SECRET_KEY = 'django-insecure-tz%&(g*jikac%ogq%vaf&%i!6m99q_lshu9g-&sz&bw8x!&zk3'
|
||||
|
||||
MEDIA_ROOT = BASE_DIR.joinpath("media")
|
||||
DATA_ROOT = BASE_DIR.joinpath("dev_data")
|
||||
MEDIA_ROOT = DATA_ROOT.joinpath("media/")
|
||||
STATIC_ROOT = DATA_ROOT.joinpath("static/")
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
CORS_ALLOW_ALL_ORIGINS = True
|
||||
@@ -5,11 +5,11 @@ print("USING RELEASE SETTINGS")
|
||||
|
||||
SECRET_KEY = 'django-insecure-tz%&(g*jikac%ogq%vaf&%i!6m99q_lshu9g-&sz&bw8x!&zk3'
|
||||
|
||||
DATA_ROOT = Path("/opt/django/data").resolve()
|
||||
DATA_ROOT = Path("/home/groceries/data/").resolve()
|
||||
MEDIA_ROOT = DATA_ROOT.joinpath("media/")
|
||||
STATIC_ROOT = DATA_ROOT.joinpath("static/")
|
||||
|
||||
ALLOWED_HOSTS = ["groceries.alaevens.ca"]
|
||||
ALLOWED_HOSTS = ["groceries.alaevens.ca", "127.0.0.1", "0.0.0.0"]
|
||||
|
||||
if not MEDIA_ROOT.is_dir():
|
||||
os.makedirs(MEDIA_ROOT.as_posix())
|
||||
|
||||
@@ -17,10 +17,16 @@ from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.conf.urls.static import static
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/', include("api.urls")),
|
||||
path('auth/', include("users.urls")),
|
||||
path('api-auth/', include('rest_framework.urls')),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
]
|
||||
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
|
||||
print("URLPATTERNS:", urlpatterns)
|
||||
|
||||
@@ -1,46 +1,31 @@
|
||||
asgiref==3.5.2
|
||||
asgiref==3.7.2
|
||||
async-timeout==4.0.2
|
||||
attrs==22.1.0
|
||||
autobahn==22.7.1
|
||||
Automat==22.10.0
|
||||
certifi==2022.9.24
|
||||
cffi==1.15.1
|
||||
channels==4.0.0
|
||||
channels-redis==4.0.0
|
||||
charset-normalizer==2.1.1
|
||||
constantly==15.1.0
|
||||
cryptography==38.0.4
|
||||
daphne==4.0.0
|
||||
click==8.1.7
|
||||
Django==4.1.3
|
||||
django-cors-headers==3.13.0
|
||||
django-filter==22.1
|
||||
django-nested-admin==4.0.2
|
||||
djangorestframework==3.14.0
|
||||
docopt==0.6.2
|
||||
gunicorn==20.1.0
|
||||
hyperlink==21.0.0
|
||||
idna==3.4
|
||||
incremental==22.10.0
|
||||
gunicorn==21.2.0
|
||||
h11==0.14.0
|
||||
idna==3.6
|
||||
Markdown==3.4.1
|
||||
msgpack==1.0.4
|
||||
packaging==21.3
|
||||
Pillow==9.3.0
|
||||
pipreqs==0.4.11
|
||||
pyasn1==0.4.8
|
||||
pyasn1-modules==0.2.8
|
||||
pycparser==2.21
|
||||
pyOpenSSL==22.1.0
|
||||
pyparsing==3.0.9
|
||||
python-monkey-business==1.0.0
|
||||
pytz==2022.6
|
||||
redis==4.3.5
|
||||
requests==2.28.1
|
||||
service-identity==21.1.0
|
||||
six==1.16.0
|
||||
sqlparse==0.4.3
|
||||
Twisted==22.10.0
|
||||
txaio==22.2.1
|
||||
typing_extensions==4.4.0
|
||||
urllib3==1.26.13
|
||||
uvicorn==0.27.1
|
||||
yarg==0.1.9
|
||||
zope.interface==5.5.2
|
||||
|
||||
46
one_trip_api/requirements.txt.old
Normal file
46
one_trip_api/requirements.txt.old
Normal file
@@ -0,0 +1,46 @@
|
||||
asgiref==3.5.2
|
||||
async-timeout==4.0.2
|
||||
attrs==22.1.0
|
||||
autobahn==22.7.1
|
||||
Automat==22.10.0
|
||||
certifi==2022.9.24
|
||||
cffi==1.15.1
|
||||
channels==4.0.0
|
||||
channels-redis==4.0.0
|
||||
charset-normalizer==2.1.1
|
||||
constantly==15.1.0
|
||||
cryptography==38.0.4
|
||||
daphne==4.0.0
|
||||
Django==4.1.3
|
||||
django-cors-headers==3.13.0
|
||||
django-filter==22.1
|
||||
django-nested-admin==4.0.2
|
||||
djangorestframework==3.14.0
|
||||
docopt==0.6.2
|
||||
gunicorn==20.1.0
|
||||
hyperlink==21.0.0
|
||||
idna==3.4
|
||||
incremental==22.10.0
|
||||
Markdown==3.4.1
|
||||
msgpack==1.0.4
|
||||
packaging==21.3
|
||||
Pillow==9.3.0
|
||||
pipreqs==0.4.11
|
||||
pyasn1==0.4.8
|
||||
pyasn1-modules==0.2.8
|
||||
pycparser==2.21
|
||||
pyOpenSSL==22.1.0
|
||||
pyparsing==3.0.9
|
||||
python-monkey-business==1.0.0
|
||||
pytz==2022.6
|
||||
redis==4.3.5
|
||||
requests==2.28.1
|
||||
service-identity==21.1.0
|
||||
six==1.16.0
|
||||
sqlparse==0.4.3
|
||||
Twisted==22.10.0
|
||||
txaio==22.2.1
|
||||
typing_extensions==4.4.0
|
||||
urllib3==1.26.13
|
||||
yarg==0.1.9
|
||||
zope.interface==5.5.2
|
||||
Reference in New Issue
Block a user