Fix(Docker): Seperate DEV and PROD
- Restructured the project
This commit is contained in:
33
backend/Dockerfile
Normal file
33
backend/Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
||||
# build stage
|
||||
FROM python:3.11 AS builder
|
||||
|
||||
# install PDM
|
||||
RUN pip install -U pip setuptools wheel
|
||||
RUN pip install pdm
|
||||
|
||||
# copy files
|
||||
COPY pyproject.toml pdm.lock README.md /backend/
|
||||
COPY install.sh /backend/
|
||||
COPY src/ /backend/src
|
||||
|
||||
# import ENV
|
||||
ARG ENV
|
||||
|
||||
# install dependencies and project into the local packages directory
|
||||
WORKDIR /backend
|
||||
RUN mkdir __pypackages__ && chmod u+x install.sh && ./install.sh
|
||||
|
||||
# run stage
|
||||
FROM python:3.11
|
||||
|
||||
# retrieve packages from build stage
|
||||
ENV PYTHONPATH=/backend/pkgs
|
||||
COPY --from=builder /backend/__pypackages__/3.11/lib /backend/pkgs
|
||||
|
||||
# retrieve executables
|
||||
COPY --from=builder /backend/__pypackages__/3.11/bin/* /bin/
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# set command/entrypoint, adapt to fit your needs
|
||||
CMD ["python3","-m", "uvicorn", "neo_neo_todo.main:app", "--reload"]
|
||||
Reference in New Issue
Block a user