Skip to content

Commit 3fb645d

Browse files
committed
fix: docker image size reduction. (3.76 GB to 2.04GB)
1 parent 786efb5 commit 3fb645d

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ USER root
44

55
WORKDIR /app
66

7-
COPY /.git ./.git
8-
COPY .gitmodules .
9-
107
COPY /api ./api
118
COPY requirements.txt .
9+
COPY Makefile .
1210

13-
RUN apt-get update && apt-get install -y git
11+
RUN apt-get update && apt-get install -y git make
1412

1513
RUN mkdir assets
16-
RUN git submodule update --init --recursive
14+
RUN make pull-repo
1715
RUN cd ./assets/git_repo && git config features.manyFiles 1
1816

1917
RUN pip install -r requirements.txt

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ run:
77
test:
88
ruff .
99

10-
pull-submodules:
11-
git submodule update --init --recursive
10+
pull-repo:
11+
git clone https://github.com/cat-milk/Anime-Girls-Holding-Programming-Books ./assets/git_repo
1212

1313
docker-build:
1414
python scripts/docker_build.py

api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.3.5"
1+
__version__ = "1.3.6"

api/anime_girls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from .errors import APIException
1515

16+
EXCLUDED_DIRS = [".git"]
1617
EXCLUDED_FILES = [".DS_Store"]
1718
GIT_REPO_PATH = "./assets/git_repo"
1819
GIT_REPO_URL = "https://github.com/cat-milk/Anime-Girls-Holding-Programming-Books"
@@ -105,7 +106,7 @@ class AGHPB():
105106
"""Interface to the anime girls holding programming books directory."""
106107
def __init__(self) -> None:
107108
self.books: List[Book] = []
108-
self.categories = [x for x in os.listdir(GIT_REPO_PATH) if os.path.isdir(f"{GIT_REPO_PATH}/{x}")]
109+
self.categories = [x for x in os.listdir(GIT_REPO_PATH) if os.path.isdir(f"{GIT_REPO_PATH}/{x}") and not x in EXCLUDED_DIRS]
109110

110111
print(Colours.ORANGE.apply("Loading books..."))
111112

@@ -119,7 +120,7 @@ def __init__(self) -> None:
119120
book = Book(f"{GIT_REPO_PATH}/{category}/{book}", str(_id))
120121
self.books.append(book)
121122

122-
sys.stdout.write(f"Book '{Colours.BLUE.apply(book.name)}' added!\n")
123+
sys.stdout.write(f"Book '{Colours.PINK_GREY.apply(book.category)} - {Colours.BLUE.apply(book.name)}' added!\n")
123124
_id += 1
124125

125126
print(Colours.GREEN.apply("[Done!]"))

0 commit comments

Comments
 (0)