Skip to content

Commit

Permalink
Merge pull request #12 from OVINC-CN/chore_build
Browse files Browse the repository at this point in the history
chore(build): shrink image size
  • Loading branch information
OrenZhang authored Nov 1, 2024
2 parents 492f759 + 8dd71a1 commit b7e387b
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 31 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
26 changes: 0 additions & 26 deletions .env.tpl

This file was deleted.

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,R0901,R0903,C0209 --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 @@ -5,6 +5,9 @@
env
.env

# Trasnlation
*.mo

# Python
*.pyc
*.db
Expand Down
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
FROM python:3.10
RUN mkdir -p /usr/src/app/celery-logs /usr/src/app/logs /usr/src/app/daphne-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 export https_proxy=http://10.1.0.163:6152 && export http_proxy=http://10.1.0.163:6152 && export all_proxy=socks5://10.1.0.163:6153 && 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/celery-logs /usr/src/app/logs /usr/src/app/daphne-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=union-api
APP_SECRET=union-api
BACKEND_URL=https://dev-api.example.com
BACKEND_HOST=dev-api.example.com
FRONTEND_URL=https://dev.example.com
DB_NAME=union-api
DB_USER=union-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,R0901,R0903,C0209 --max-line-length=120 $(git ls-files '*.py')

0 comments on commit b7e387b

Please sign in to comment.