sfun commited on
Commit
5c97f85
1 Parent(s): c5a5055

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -17
Dockerfile CHANGED
@@ -1,33 +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
- # Install python3 and pip
8
- RUN apk add --no-cache python3 py3-pip
 
 
9
 
10
- # Create a virtual environment
11
- RUN python3 -m venv /venv
12
 
13
- # Activate the virtual environment and install grpcio
14
- RUN /venv/bin/pip install grpcio
15
 
16
- # Set the virtual environment as the default Python environment
17
- ENV PATH="/venv/bin:$PATH"
18
-
19
  # retrieve packages from build stage
20
  ENV PYTHONPATH=/project/pkgs
21
 
22
- WORKDIR /project
23
-
24
  RUN chmod 777 -R /project
25
  RUN mkdir -p ./sync && chmod 777 -R ./sync
26
 
27
- COPY --from=builder /project/pkgs /project/pkgs
28
  COPY --from=builder /project/app /project/app
29
- COPY Caddyfile ./Caddyfile
30
 
31
  EXPOSE 3000
32
 
33
- 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"]