Skip to content

Commit 4bfe2c1

Browse files
committed
fix: 将字体文件直接放入后端镜像
1 parent 8e2959b commit 4bfe2c1

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.github/workflows/backend.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Check Out Repo
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Set up QEMU
1919
uses: docker/setup-qemu-action@v3
@@ -22,15 +22,15 @@ jobs:
2222
uses: docker/setup-buildx-action@v3
2323

2424
- name: Login to Docker Hub
25-
uses: docker/login-action@v1
25+
uses: docker/login-action@v3
2626
with:
2727
username: ${{ secrets.DOCKER_HUB_USERNAME }}
2828
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
2929

3030
- name: Build and Push Image
31-
uses: docker/build-push-action@v2
31+
uses: docker/build-push-action@v5
3232
with:
33-
context: ./backend
33+
context: .
3434
file: ./backend/dockerfile.backend
3535
push: true
3636
tags: 14790897/backend-handwriting:latest

backend/dockerfile.backend

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,23 @@ RUN apt-get update && apt-get install -y \
1414
rm -rf /var/lib/apt/lists/*
1515

1616
# Copy requirements first to leverage Docker cache
17-
COPY requirements.txt /app/
17+
COPY backend/requirements.txt /app/requirements.txt
1818

1919
# Install any needed packages specified in requirements.txt
2020
RUN pip install --no-cache-dir -r requirements.txt
2121

2222
# Install gunicorn (if it's not in your requirements.txt)
2323
RUN pip install gunicorn
2424

25-
# Copy the current directory contents into the container at /app
25+
# Copy the backend source code into the container at /app
2626
# Do this last so code changes don't invalidate the pip install cache
27-
COPY . /app
27+
COPY backend /app
28+
29+
# Copy default fonts into the image
30+
COPY ttf_files /app/font_assets
2831

2932
# Make port 5000 available to the world outside this container
3033
EXPOSE 5000
3134

3235
# Run gunicorn when the container launches
33-
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:5000", "-w", "1", "--threads", "2", "--timeout", "300", "--access-logfile", "-", "--error-logfile", "-"]
36+
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:5000", "-w", "1", "--threads", "2", "--timeout", "300", "--access-logfile", "-", "--error-logfile", "-"]

0 commit comments

Comments
 (0)