-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile_mac
45 lines (30 loc) · 1.49 KB
/
Dockerfile_mac
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
# Build python dependencies
FROM --platform=linux/amd64 python:3.10.12-slim as pybuilder
RUN apt-get update && apt-get install -y uvicorn gcc g++
RUN python -m pip --no-cache-dir install pdm
RUN pdm config python.use_venv false
WORKDIR /project/app
# Copy pyproject.toml and pdm.lock to install dependencies
COPY pyproject.toml pdm.lock /project/app/
RUN pdm install
# Copy your application code
COPY ./api /project/app/api
RUN ls -R /project
# Create final image
FROM --platform=linux/amd64 python:3.10.12-slim
RUN apt-get update && apt-get install -y wget gnupg supervisor
# Add Google Chrome's official GPG key and repository
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | \
gpg --dearmor > /usr/share/keyrings/google-linux-signing-keyring.gpg
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-linux-signing-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \
> /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update && apt-get install -y google-chrome-stable
ENV PYTHONPATH=/project/pkgs
# Copy dependencies and binaries from builder stage
COPY --from=pybuilder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
COPY --from=pybuilder /usr/local/bin /usr/local/bin
# Copy the application files from builder stage
COPY --from=pybuilder /project/app /project/
EXPOSE 8000
WORKDIR /project/
CMD ["pdm", "run", "python", "-m", "uvicorn", "api.chrome_ext_thon:app", "--reload", "--host", "0.0.0.0", "--port", "8000"]