Compare commits
2 commits
7b6f0db170
...
fa96ad7ea3
Author | SHA1 | Date | |
---|---|---|---|
|
fa96ad7ea3 | ||
|
2a2545a348 |
8 changed files with 98 additions and 3 deletions
5
.dockerignore
Normal file
5
.dockerignore
Normal file
|
@ -0,0 +1,5 @@
|
|||
venv
|
||||
target
|
||||
__pycache__
|
||||
pflaenzli/media
|
||||
*.sqlite3
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
FROM python:3.11
|
||||
|
||||
RUN apt update && apt install -y libpq-dev nginx
|
||||
|
||||
ADD requirements.txt requirements.txt
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY pflaenzli /app
|
||||
COPY entrypoint.sh /app
|
||||
COPY default /etc/nginx/sites-enabled/default
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
RUN python3 manage.py collectstatic --no-input -c
|
||||
|
||||
ENTRYPOINT /app/entrypoint.sh
|
27
Jenkinsfile
vendored
Normal file
27
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Pull git') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Build Docker Image') {
|
||||
steps {
|
||||
script {
|
||||
def dockerImage = docker.build('pflaenzli', '-f Dockerfile . --tag pflaenzli:${env.BUILD_NUMBER}')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push Docker Image') {
|
||||
steps {
|
||||
script {
|
||||
docker.withRegistry('https://git.thisfro.ch', 'jenkins-ci') {
|
||||
dockerImage.push()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
default
Normal file
19
default
Normal file
|
@ -0,0 +1,19 @@
|
|||
server {
|
||||
listen 80;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location /static {
|
||||
access_log off;
|
||||
alias /app/pflaenzli/static_collected;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
access_log off;
|
||||
client_max_body_size 10M;
|
||||
}
|
||||
}
|
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
pflaenzli:
|
||||
build: .
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
DOCKER: True
|
||||
|
||||
db:
|
||||
image: postgres:15
|
||||
command: postgres -c password_encryption=md5
|
||||
environment:
|
||||
POSTGRES_PASSWORD: development
|
||||
POSTGRES_USER: pflaenzli
|
||||
POSTGRES_DB: pflaenzli
|
||||
POSTGRES_INITDB_ARGS: "--auth-local=md5"
|
6
entrypoint.sh
Normal file
6
entrypoint.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
python manage.py migrate
|
||||
|
||||
nginx
|
||||
|
||||
gunicorn --bind :8000 --workers 4 pflaenzli_django.wsgi:application
|
|
@ -32,8 +32,8 @@ SECRET_KEY = "django-insecure-q=ps#iypevr!3zfpwtfp3lw#4r3%oyj*(2=*iq^8f4_zbodi^(
|
|||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
ALLOWED_HOSTS = ["localhost"]
|
||||
CSRF_TRUSTED_ORIGINS = ["http://localhost:8080", "https://staging.pflaenz.li"]
|
||||
|
||||
# Application definition
|
||||
|
||||
|
@ -144,7 +144,7 @@ USE_TZ = True
|
|||
STATIC_URL = "static/"
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
MEDIA_URL = "media/"
|
||||
|
||||
STATIC_ROOT = "/app/pflaenzli/static_collected"
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
||||
|
|
|
@ -3,6 +3,7 @@ Django==4.1.7
|
|||
django-bootstrap5==22.2
|
||||
django-crispy-forms==2.0
|
||||
django-jquery==3.1.0
|
||||
django-friendly-captcha==0.1.7
|
||||
geopy==2.3.0
|
||||
gunicorn==20.1.0
|
||||
fontawesomefree==6.3.0
|
||||
|
|
Loading…
Reference in a new issue