-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from fsinfuhh/feat/devDocker
add dev docker
- Loading branch information
Showing
15 changed files
with
160 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
services: | ||
database: | ||
image: postgres | ||
volumes: | ||
- ./dev_db:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_USER={{ cookiecutter.project_slug }} | ||
- POSTGRES_PASSWORD={{ cookiecutter.project_slug }} | ||
- POSTGRES_DB={{ cookiecutter.project_slug }} | ||
|
||
backend: | ||
build: | ||
context: ./ | ||
dockerfile: ./docker/dev/backend/Dockerfile | ||
volumes: | ||
- ./:/app/backend | ||
depends_on: | ||
- database | ||
|
||
frontend: | ||
build: docker/dev/frontend | ||
volumes: | ||
- ./src/{{ cookiecutter.project_slug }}_gui:/app/frontend | ||
|
||
webserver: | ||
build: docker/dev/webserver | ||
depends_on: | ||
- backend | ||
- frontend | ||
- database | ||
ports: | ||
- 8000:8000 | ||
- 3000:3000 |
21 changes: 21 additions & 0 deletions
21
{{ cookiecutter.project_slug }}/docker/dev/backend/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM python:3.11-slim | ||
|
||
# Install normal dependencies | ||
RUN apt-get update && apt-get -y --no-install-recommends install build-essential nginx && rm -rf /var/lib/apt/lists/* | ||
|
||
# Add project code to container | ||
VOLUME /app/backend | ||
WORKDIR /app/backend | ||
|
||
# Install Python dependencies | ||
RUN pip3 install pipenv==v2022.4.20 | ||
|
||
RUN usermod -u 2009 -g 33 -d /app/backend www-data | ||
|
||
ADD ./docker/dev/backend/env.dev.local /app/config/.env.dev.local | ||
|
||
EXPOSE 8000 | ||
|
||
#USER www-data:www-data | ||
ADD ./docker/dev/backend/start.sh /usr/local/bin/start.sh | ||
CMD ["bash", "/usr/local/bin/start.sh"] |
1 change: 1 addition & 0 deletions
1
{{ cookiecutter.project_slug }}/docker/dev/backend/env.dev.local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DJANGO_DB=postgres://{{ cookiecutter.project_slug }}:{{ cookiecutter.project_slug }}@database:5432/{{ cookiecutter.project_slug }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
ln -sf /app/config/.env.dev.local /app/backend/.env.dev.local | ||
|
||
pipenv install --dev --system --ignore-pipfile | ||
|
||
python3 src/manage.py migrate | ||
python3 src/manage.py runserver 0.0.0.0:8000 |
15 changes: 15 additions & 0 deletions
15
{{ cookiecutter.project_slug }}/docker/dev/frontend/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:21-slim | ||
|
||
VOLUME /app/frontend | ||
WORKDIR /app/frontend | ||
|
||
ADD ./start.sh /usr/local/bin/start.sh | ||
|
||
RUN npm install -g pnpm | ||
|
||
RUN chmod 774 /usr/local/bin/start.sh | ||
|
||
USER 1000 | ||
EXPOSE 3000 | ||
|
||
CMD ["bash", "/usr/local/bin/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
pnpm install | ||
npm run dev |
5 changes: 5 additions & 0 deletions
5
{{ cookiecutter.project_slug }}/docker/dev/webserver/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM nginx:stable | ||
|
||
ADD nginx.conf /etc/nginx/nginx.conf | ||
|
||
EXPOSE 8000 |
58 changes: 58 additions & 0 deletions
58
{{ cookiecutter.project_slug }}/docker/dev/webserver/nginx.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
user nginx; | ||
worker_processes auto; | ||
|
||
error_log /var/log/nginx/error.log notice; | ||
pid /var/run/nginx.pid; | ||
|
||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" '; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
|
||
keepalive_timeout 65; | ||
|
||
server { | ||
listen 8000; | ||
server_name default_server; | ||
|
||
location ~* ^/(django-static|api|admin|media).* { | ||
proxy_pass http://backend:8000; | ||
proxy_hide_header Upgrade; | ||
client_max_body_size 0; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
|
||
location / { | ||
proxy_pass http://frontend:3000/; | ||
proxy_hide_header Upgrade; | ||
client_max_body_size 0; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
|
||
location /_nuxt { | ||
proxy_pass http://frontend:3000/_nuxt; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_set_header Host $host; | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.