Setup for M1 mac & cleanup
This commit is contained in:
parent
328aa50acc
commit
327f8d8cd0
4 changed files with 21 additions and 54 deletions
12
docker-compose-build.yaml
Normal file
12
docker-compose-build.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
version: '2.4'
|
||||||
|
services:
|
||||||
|
django:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.yaml
|
||||||
|
service: django
|
||||||
|
image: crocmagnon/blog:latest
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
staticfiles: {}
|
||||||
|
media: {}
|
|
@ -1,7 +1,7 @@
|
||||||
version: '2.4'
|
version: '2.4'
|
||||||
services:
|
services:
|
||||||
django:
|
django:
|
||||||
image: crocmagnon/blog:latest
|
image: crocmagnon/blog:dev
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
|
@ -15,16 +15,6 @@ services:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
init: true
|
init: true
|
||||||
tty: true
|
tty: true
|
||||||
depends_on:
|
|
||||||
- nginx
|
|
||||||
nginx:
|
|
||||||
image: nginx:1.19.2
|
|
||||||
ports:
|
|
||||||
- 8000:80
|
|
||||||
volumes:
|
|
||||||
- staticfiles:/app/static
|
|
||||||
- media:/app/media
|
|
||||||
- ./docker/nginx-dev.conf:/etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
staticfiles: {}
|
staticfiles: {}
|
|
@ -1,41 +0,0 @@
|
||||||
server {
|
|
||||||
server_name localhost:8000;
|
|
||||||
|
|
||||||
client_max_body_size 10M;
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
gzip_types
|
|
||||||
application/javascript
|
|
||||||
application/x-javascript
|
|
||||||
application/json
|
|
||||||
application/rss+xml
|
|
||||||
application/xml
|
|
||||||
application/vnd.ms-fontobject
|
|
||||||
application/font-sfnt
|
|
||||||
image/svg+xml
|
|
||||||
image/x-icon
|
|
||||||
text/xml
|
|
||||||
text/javascript
|
|
||||||
text/css
|
|
||||||
text/plain;
|
|
||||||
gzip_min_length 256;
|
|
||||||
gzip_comp_level 5;
|
|
||||||
gzip_http_version 1.1;
|
|
||||||
gzip_vary on;
|
|
||||||
|
|
||||||
location /media/ {
|
|
||||||
alias /app/media/;
|
|
||||||
expires 30d;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
proxy_pass http://django:8000;
|
|
||||||
proxy_redirect off;
|
|
||||||
}
|
|
||||||
|
|
||||||
listen [::]:80;
|
|
||||||
listen 80;
|
|
||||||
}
|
|
10
tasks.py
10
tasks.py
|
@ -16,6 +16,8 @@ from invoke import Context, task
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).parent.resolve(strict=True)
|
BASE_DIR = Path(__file__).parent.resolve(strict=True)
|
||||||
SRC_DIR = BASE_DIR / "src"
|
SRC_DIR = BASE_DIR / "src"
|
||||||
|
COMPOSE_BUILD_FILE = BASE_DIR / "docker-compose-build.yaml"
|
||||||
|
COMPOSE_BUILD_ENV = {"COMPOSE_FILE": COMPOSE_BUILD_FILE}
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
|
@ -55,13 +57,17 @@ def check(ctx: Context) -> None:
|
||||||
@task
|
@task
|
||||||
def build(ctx: Context) -> None:
|
def build(ctx: Context) -> None:
|
||||||
with ctx.cd(BASE_DIR):
|
with ctx.cd(BASE_DIR):
|
||||||
ctx.run("docker-compose build django", pty=True, echo=True)
|
ctx.run(
|
||||||
|
"docker-compose build django", pty=True, echo=True, env=COMPOSE_BUILD_ENV
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def publish(ctx: Context) -> None:
|
def publish(ctx: Context) -> None:
|
||||||
with ctx.cd(BASE_DIR):
|
with ctx.cd(BASE_DIR):
|
||||||
ctx.run("docker-compose push django", pty=True, echo=True)
|
ctx.run(
|
||||||
|
"docker-compose push django", pty=True, echo=True, env=COMPOSE_BUILD_ENV
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
|
|
Reference in a new issue