Skip to content

Commit 0697bd5

Browse files
committed
try to add less to container
1 parent 4150c54 commit 0697bd5

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

.dockerignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
**/*
22

3-
!/src/**/*.py
3+
!/src/
4+
!/accents/*.py
45
!/uv.lock
56
!/pyproject.toml
6-
!/accents
77
!/accents2/
88
!/schema.sql
9+
10+
**/__pycache__/
11+
**/*.egg-info

Dockerfile

+9-8
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ ENV PYTHONUNBUFFERED=yes \
1515

1616
WORKDIR /code
1717

18-
COPY --from=ghcr.io/astral-sh/uv:0.3.3 /uv /bin/uv
19-
COPY uv.lock .
20-
COPY pyproject.toml .
18+
COPY --from=ghcr.io/astral-sh/uv:0.3.5 /uv /bin/uv
19+
COPY uv.lock pyproject.toml .
2120

22-
RUN : \
21+
RUN --mount=type=cache,target=/root/.cache/uv : \
2322
&& apk add --no-cache \
2423
# gif optimizer
2524
gifsicle \
2625
# Font for trocr
2726
ttf-dejavu \
28-
&& uv sync --frozen --no-cache --no-dev \
29-
&& rm /bin/uv
27+
&& uv sync --frozen --no-dev --link-mode=copy \
28+
&& rm /bin/uv pyproject.toml uv.lock
3029

3130
COPY --from=accents_builder /build/target/release/sayit /usr/bin/sayit
3231

@@ -46,7 +45,9 @@ RUN addgroup -g $GID -S pink \
4645

4746
USER pink
4847

49-
COPY --chown=pink:pink . .
50-
RUN rm uv.lock pyproject.toml
48+
COPY --chown=pink:pink src src
49+
COPY --chown=pink:pink accents2/examples accents2/examples
50+
COPY --chown=pink:pink accents accents
51+
COPY --chown=pink:pink schema.sql .
5152

5253
ENTRYPOINT ["/code/.venv/bin/python", "-m", "src"]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This is a personal discord bot that has a few commands related to Unitystation.
99
Rough instructions:
1010

1111
Building podman/docker image: `podman build . -t fogapod/pink` (no tricks)
12-
Running podman/docker image: `podman run --rm --name pink -v $(pwd)/settings.toml:/code/settings.toml -v $(pwd)/pink.db:/code/pink.db fogapod/pink`
12+
Running podman/docker image: `podman run --rm --name pink -v $(pwd)/settings.toml:/code/settings.toml -v $(pwd)/pink.db:/data/pink.db fogapod/pink`
1313

1414
Running on production:
1515

pyproject.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
name = "PINK"
33
version = "0.1.0"
44
description = "Potato Is Not Kiwi"
5-
readme = "README.md"
65
requires-python = "==3.12.*"
76
dependencies = [
87
"discord-py[speed]>=2.0",
@@ -17,6 +16,11 @@ dependencies = [
1716
"yarl>=1.9.4",
1817
]
1918

19+
# a way to have virtual package until https://github.com/astral-sh/uv/pull/6585
20+
# is released
21+
[tool.uv.workspace]
22+
members = []
23+
2024
[tool.uv]
2125
dev-dependencies = [
2226
"mypy>=1.11.2",

0 commit comments

Comments
 (0)