Skip to content

Commit ec5eae5

Browse files
committed
fix docker build error
1 parent 1c37db7 commit ec5eae5

1 file changed

Lines changed: 43 additions & 42 deletions

File tree

Dockerfile

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,49 @@
33
FROM alpine:3.18 AS python-base
44

55
ENV LANG="C.UTF-8" \
6-
TZ=Asia/Shanghai \
7-
PUID=1000 \
8-
PGID=1000 \
9-
UMASK=022 \
10-
VENV_PATH="/opt/venv"
6+
TZ=Asia/Shanghai \
7+
PUID=1000 \
8+
PGID=1000 \
9+
UMASK=022 \
10+
VENV_PATH="/opt/venv"
1111

1212
# Install runtime system packages
1313
RUN set -ex && \
14-
apk add --no-cache \
15-
bash \
16-
busybox-suid \
17-
python3 \
18-
py3-aiohttp \
19-
py3-bcrypt \
20-
curl \
21-
su-exec \
22-
shadow \
23-
tini \
24-
openssl \
25-
tzdata && \
26-
# Set timezone
27-
ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && \
28-
echo $TZ > /etc/timezone
14+
apk add --no-cache \
15+
bash \
16+
busybox-suid \
17+
python3 \
18+
py3-aiohttp \
19+
py3-bcrypt \
20+
curl \
21+
su-exec \
22+
shadow \
23+
tini \
24+
openssl \
25+
tzdata && \
26+
# Set timezone
27+
ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && \
28+
echo $TZ > /etc/timezone
2929

3030
# Stage 2: Build dependencies
3131
FROM python-base AS build-deps
3232

3333
# Install build tools and dependencies
3434
RUN set -ex && \
35-
apk add --no-cache \
36-
build-base \
37-
gcc \
38-
musl-dev \
39-
libffi-dev \
40-
python3-dev \
41-
rust \
42-
cargo
35+
apk add --no-cache \
36+
build-base \
37+
gcc \
38+
musl-dev \
39+
libffi-dev \
40+
python3-dev \
41+
rust \
42+
cargo
4343

4444
# Install uv package manager
4545
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
46-
mv /root/.cargo/bin/uv /usr/local/bin/uv && \
47-
uv --version
46+
mv /root/.local/bin/uv /usr/local/bin/uv && \
47+
mv /root/.local/bin/uvx /usr/local/bin/uvx && \
48+
uv --version
4849

4950
# Stage 3: Python virtual environment
5051
FROM build-deps AS python-venv
@@ -58,14 +59,14 @@ COPY backend/pyproject.toml backend/uv.lock ./
5859

5960
# Create virtual environment and install dependencies
6061
RUN set -ex && \
61-
# Check if lock file exists and is readable
62-
ls -la uv.lock && \
63-
# Create virtual environment
64-
python3 -m venv ${VENV_PATH} && \
65-
# Install dependencies using uv
66-
uv sync --frozen --no-dev && \
67-
# Clear cache
68-
rm -rf /root/.cache
62+
# Check if lock file exists and is readable
63+
ls -la uv.lock && \
64+
# Create virtual environment
65+
python3 -m venv ${VENV_PATH} && \
66+
# Install dependencies using uv
67+
uv sync --frozen --no-dev && \
68+
# Clear cache
69+
rm -rf /root/.cache
6970

7071
# Stage 4: Final runtime image
7172
FROM python-base AS final
@@ -79,9 +80,9 @@ COPY --from=python-venv --chown=root:root ${VENV_PATH} ${VENV_PATH}
7980

8081
# Add user
8182
RUN set -ex && \
82-
mkdir -p /home/ab && \
83-
addgroup -S ab -g 911 && \
84-
adduser -S ab -G ab -h /home/ab -s /sbin/nologin -u 911
83+
mkdir -p /home/ab && \
84+
addgroup -S ab -g 911 && \
85+
adduser -S ab -G ab -h /home/ab -s /sbin/nologin -u 911
8586

8687
# Copy application code and scripts
8788
COPY --chmod=755 backend/src/. .
@@ -93,4 +94,4 @@ RUN chown -R ab:ab /app /home/ab
9394
ENTRYPOINT ["tini", "-g", "--", "/entrypoint.sh"]
9495

9596
EXPOSE 7892
96-
VOLUME [ "/app/config" , "/app/data" ]
97+
VOLUME [ "/app/config" , "/app/data" ]

0 commit comments

Comments
 (0)