Skip to content

Commit

Permalink
chore(build): shrink image size
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenZhang committed Nov 1, 2024
1 parent 30c234d commit 12ad0e7
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/OVINC-CN/DevTemplateDjango.git",
"commit": "ef125c550e0dc7f52fff1a3e4d1b4a73cebd8e32",
"commit": "77faa1ff4b8231ddbe45ee359b592442a9c4cda1",
"checkout": "main",
"context": {
"cookiecutter": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint --disable=C0114,W0613,C0115,W1113,W0223,C0116,R0903,R0901,W0236 --max-line-length=120 $(git ls-files '*.py')
make pylint
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ env

# Static
static

# Trasnlation
*.mo
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
FROM python:3.10
RUN mkdir -p /usr/src/app/logs
COPY . /usr/src/app
FROM python:3.10.15-slim

WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/
RUN pip3 install -U pip && pip3 install -r requirements.txt

COPY . /usr/src/app

RUN apt-get update && apt-get install -y gettext
RUN cp env.example .env \
&& python3 manage.py compilemessages -l zh_Hans \
&& rm -rf .env

RUN mkdir -p /usr/src/app/logs
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pylint:
scripts/pylint.sh

pre-commit:
scripts/pre-commit.sh

lint: pre-commit pylint
16 changes: 16 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
APP_CODE=iwiki-api
APP_SECRET=iwiki-api
BACKEND_URL=https://dev-api.example.com
BACKEND_HOST=dev-api.example.com
FRONTEND_URL=https://dev.example.com
DB_NAME=iwiki-api
DB_USER=iwiki-api
DB_PASSWORD=
DB_HOST=127.0.0.1
DB_PORT=3306
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
OVINC_API_DOMAIN=https://api.example.com
OVINC_WEB_URL=https://www.example.com
2 changes: 2 additions & 0 deletions scripts/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
pre-commit run -a
2 changes: 2 additions & 0 deletions scripts/pylint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
pylint --disable=C0114,W0613,C0115,W1113,W0223,C0116,R0903 --max-line-length=120 $(git ls-files '*.py')

0 comments on commit 12ad0e7

Please sign in to comment.