-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
65 lines (40 loc) · 1.63 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# syntax=docker/dockerfile:1
FROM node:21-slim AS frontend
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY --link ./package.json ./pnpm-lock.yaml ./tailwind.config.js ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY ./src/zulip_write_only_proxy/frontend/templates/ \
./src/zulip_write_only_proxy/frontend/templates/
RUN pnpm build
ADD --link https://unpkg.com/htmx.org@1.9.10/dist/htmx.js \
https://unpkg.com/htmx.org@1.9.10/dist/htmx.min.js \
./src/zulip_write_only_proxy/frontend/static/
FROM python:3.12-alpine AS prod
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONOPTIMIZE 2
WORKDIR /app
RUN apk update && apk add --no-cache openssh
RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install --upgrade poetry pip && \
poetry config virtualenvs.create false --local
COPY ./poetry.lock ./pyproject.toml ./README.md /app/
RUN --mount=type=cache,target=/root/.cache \
poetry install --no-root
COPY --link ./src /app/src
RUN --mount=type=cache,target=/root/.cache poetry install
COPY --link --from=frontend /app/src/zulip_write_only_proxy/frontend/static \
/app/src/zulip_write_only_proxy/frontend/static
EXPOSE 8000
ENV ZWOP_ADDRESS=http://0.0.0.0:8000
CMD ["poe", "up"]
HEALTHCHECK --start-interval=1s --start-period=30s --interval=60s \
CMD wget --spider http://0.0.0.0:8000/api/health || exit 1
FROM prod AS dev
RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install debugpy
EXPOSE 5678
CMD ["python3", "-Xfrozen_modules=off", "-m", "debugpy", "--listen", "0.0.0.0:5678", "-m", "zulip_write_only_proxy.main"]