sfun commited on
Commit
4a21297
1 Parent(s): 21f0013

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -8
Dockerfile CHANGED
@@ -1,23 +1,29 @@
1
  # build stage
2
- FROM ghcr.io/yufeikang/raycast_api_proxy:main AS builder
 
 
 
 
 
 
 
 
 
3
 
4
  # run stage
5
- FROM caddy:alpine AS runner
6
 
7
- RUN apk add --no-cache python3
8
 
9
  # retrieve packages from build stage
10
  ENV PYTHONPATH=/project/pkgs
11
 
12
- WORKDIR /project
13
-
14
  RUN chmod 777 -R /project
15
  RUN mkdir -p ./sync && chmod 777 -R ./sync
16
 
17
- COPY --from=builder /project/pkgs /project/pkgs
18
  COPY --from=builder /project/app /project/app
19
- COPY Caddyfile ./Caddyfile
20
 
21
  EXPOSE 3000
22
 
23
- CMD ["sh", "-c", "caddy run --config /project/Caddyfile --adapter caddyfile & python -m uvicorn app.main:app --host 0.0.0.0 --port 80"]
 
1
  # build stage
2
+ FROM python:3.10 AS builder
3
+
4
+ # install PDM
5
+ RUN pip install -U pip setuptools wheel
6
+ RUN pip install pdm
7
+
8
+ # install dependencies and project into the local packages directory
9
+ WORKDIR /project
10
+ RUN git clone https://github.com/yufeikang/raycast_api_proxy.git .
11
+ RUN mkdir __pypackages__ && pdm install --prod --no-lock --no-editable
12
 
13
  # run stage
14
+ FROM python:3.10-slim
15
 
16
+ WORKDIR /project
17
 
18
  # retrieve packages from build stage
19
  ENV PYTHONPATH=/project/pkgs
20
 
 
 
21
  RUN chmod 777 -R /project
22
  RUN mkdir -p ./sync && chmod 777 -R ./sync
23
 
24
+ COPY --from=builder /project/__pypackages__/3.10/lib /project/pkgs
25
  COPY --from=builder /project/app /project/app
 
26
 
27
  EXPOSE 3000
28
 
29
+ CMD ["sh", "-c", "python -m uvicorn app.main:app --host 0.0.0.0 --port 3000"]