Skip to content

Commit

Permalink
fix: editable controller issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alberto-abarzua committed Nov 16, 2023
1 parent eb4db2d commit ecf56be
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
24 changes: 19 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
FROM python:3.11-slim-buster

ARG EDITABLE_PACKAGES
ENV EDITABLE_PACKAGES=${EDITABLE_PACKAGES}

WORKDIR /app

# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential && \
build-essential coreutils && \
rm -rf /var/lib/apt/lists/*

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

ENV PYTHONPATH=/app/src


RUN pip install --no-cache-dir pdm==2.10
RUN pip install --no-cache-dir pdm==2.10.3

COPY ./pyproject.toml ./pyproject.toml
COPY ./pdm.lock ./pdm.lock


COPY . .

RUN pdm install
RUN ls -la && sleep 5

RUN if [ "$EDITABLE_PACKAGES" = "true" ]; then \
echo "Installing editable packages"; \
pdm remove ribot-controller || true; \
pdm remove ribot-controller --dev || true; \
pdm add -e ./controller --dev; \
else \
echo "Installing non-editable packages"; \
pdm remove ribot-controller --dev; \
pdm add ribot-controller; \
fi

RUN pdm install
RUN chmod +x ./entrypoint.sh

EXPOSE 8000

ENTRYPOINT ["/app/entrypoint.sh"]

CMD ["pdm","run","start"]

11 changes: 5 additions & 6 deletions backend/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@


# check if BACKEND_UPDATE_RIBOT_CONTROLLER is set to 'true'
if [ "$BACKEND_UPDATE_RIBOT_CONTROLLER" = "true" ]; then

echo "Updating ribot-controller to latest"
echo "Updating ribot-controller to latest"
pdm update ribot-controller
fi
# if [ "$EDITABLE_PACKAGES" = "true" ]; then
# pdm remove ribot-controller || true
# pdm add -e ./controller --dev
# pdm install
# fi


exec "$@"
16 changes: 7 additions & 9 deletions backend/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dependencies = [
"fastapi>=0.101.1",
"uvicorn>=0.23.2",
"numpy>=1.20",
"ribot-controller>=0.3.4",
]
requires-python = ">=3.11"

Expand All @@ -14,6 +13,7 @@ dev = [
"flake8>=6.0.0",
"flake8-annotations>=3.0.1",
"mypy>=1.4.1",
"-e file:///${PROJECT_ROOT}/controller#egg=ribot-controller",
]


Expand Down

0 comments on commit ecf56be

Please sign in to comment.