Skip to content

Commit

Permalink
🚀 update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Oct 2, 2023
1 parent 319108f commit b237a3f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM python:3.11-bullseye as requirements-stage
FROM python:3.11-bookworm as requirements-stage

WORKDIR /tmp

Expand All @@ -11,15 +11,17 @@ COPY ./pyproject.toml ./poetry.lock* /tmp/

RUN poetry export -f requirements.txt --output requirements.txt --without-hashes --with deploy

FROM python:3.11-bullseye as build-stage
FROM python:3.11-bookworm as build-stage

WORKDIR /wheel

COPY --from=requirements-stage /tmp/requirements.txt /wheel/requirements.txt

# RUN python3 -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

RUN pip wheel --wheel-dir=/wheel --no-cache-dir --requirement /wheel/requirements.txt

FROM python:3.11-bullseye as metadata-stage
FROM python:3.11-bookworm as metadata-stage

WORKDIR /tmp

Expand All @@ -28,7 +30,7 @@ RUN --mount=type=bind,source=./.git/,target=/tmp/.git/ \
|| git rev-parse --short HEAD > /tmp/VERSION \
&& echo "Building version: $(cat /tmp/VERSION)"

FROM python:3.11-slim-bullseye
FROM python:3.11-slim-bookworm

WORKDIR /app

Expand All @@ -53,16 +55,14 @@ ENV APP_MODULE bot:app

RUN apt-get update \
&& apt-get install -y --no-install-recommends curl p7zip-full fontconfig fonts-noto-color-emoji \
&& curl -sSL https://github.com/be5invis/Sarasa-Gothic/releases/download/v0.41.3/sarasa-gothic-ttc-0.41.3.7z -o /tmp/sarasa.7z \
&& curl -sSL https://github.com/be5invis/Sarasa-Gothic/releases/download/v0.41.3/sarasa-gothic-ttc-0.42.1.7z -o /tmp/sarasa.7z \
&& 7z x /tmp/sarasa.7z -o/tmp/sarasa \
&& install -d /usr/share/fonts/sarasa-gothic \
&& install -m644 /tmp/sarasa/*.ttc /usr/share/fonts/sarasa-gothic \
&& fc-cache -fv \
&& apt-get purge -y --auto-remove curl p7zip-full \
&& rm -rf /tmp/sarasa/ /tmp/sarasa.7z

# RUN python3 -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

COPY --from=build-stage /wheel /wheel

RUN pip install --no-cache-dir --no-index --find-links=/wheel -r /wheel/requirements.txt && rm -rf /wheel
Expand Down
19 changes: 12 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
volumes:
- bot_redis_data:/data
restart: always

postgres:
image: postgres:15-alpine
environment:
Expand All @@ -20,13 +21,7 @@ services:
volumes:
- bot_postgres_data:/var/lib/postgresql/data
restart: always
go-cqhttp:
image: ghcr.io/mrs4s/go-cqhttp:latest
volumes:
- "./bot:/data"
depends_on:
- nonebot
restart: always

nonebot:
image: cscs181/qq-github-bot:latest # docker hub
# image: ghcr.io/cscs181/qq-github-bot:latest # github image mirror
Expand Down Expand Up @@ -58,6 +53,16 @@ services:
retries: 3
start_period: 30s
restart: always

go-cqhttp:
image: ghcr.io/mrs4s/go-cqhttp:latest
volumes:
- "./bot:/data"
depends_on:
- nonebot
restart: always
profiles:
- go-cqhttp
volumes:
bot_redis_data: {}
bot_postgres_data: {}

0 comments on commit b237a3f

Please sign in to comment.