@@ -2,6 +2,11 @@ FROM python:3.11-alpine3.20 AS base
22
33FROM base AS deps
44
5+ # Prevent __pycache__ directories
6+ ENV PYTHONUNBUFFERED=1 \
7+ PYTHONDONTWRITEBYTECODE=1
8+
9+
510RUN addgroup -g 1000 beetle && \
611 adduser -D -u 1000 -G beetle beetle
712
@@ -26,26 +31,17 @@ RUN --mount=type=cache,target=/var/cache/apk \
2631 apk add \
2732 imagemagick \
2833 redis \
29- git \
3034 bash \
31- keyfinder-cli \
3235 tmux \
33- wget \
34- npm \
3536 shadow
3637
37- # pnpm
38- RUN npm install -g pnpm
39-
4038# Install our package (backend)
4139COPY ./backend /repo/backend
4240COPY ./README.md /repo/README.md
4341WORKDIR /repo/backend
4442RUN --mount=type=cache,target=/root/.cache/pip \
45- pip install .
43+ pip install --no-cache-dir .
4644
47- # Frontend
48- RUN pnpm config set store-dir /repo/frontend/.pnpm-store
4945
5046# ------------------------------------------------------------------------------------ #
5147# Development #
@@ -78,8 +74,14 @@ ENTRYPOINT ["./entrypoint_test.sh"]
7874# ------------------------------------------------------------------------------------ #
7975
8076FROM deps AS build
77+ # Build frontend files
8178
82- COPY --from=deps /repo /repo
79+ RUN --mount=type=cache,target=/var/cache/apk \
80+ apk add \
81+ npm
82+
83+ RUN npm install -g pnpm
84+ RUN pnpm config set store-dir /repo/frontend/.pnpm-store
8385
8486WORKDIR /repo
8587COPY ./frontend ./frontend/
@@ -98,7 +100,6 @@ FROM deps AS prod
98100ENV IB_SERVER_CONFIG="prod"
99101
100102WORKDIR /repo
101- COPY --from=deps /repo /repo
102103COPY --from=build /repo/frontend/dist /repo/frontend/dist
103104COPY entrypoint.sh .
104105COPY entrypoint_fix_permissions.sh .
@@ -114,3 +115,4 @@ ENTRYPOINT [ \
114115 su beetle -c /repo/entrypoint.sh" \
115116]
116117
118+
0 commit comments