Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop dropping root in segmenter container #22

Merged
merged 7 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/processing-segmenter-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,6 @@ jobs:
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)

- name: Inspect image
if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'push tag'
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All dates in this file are given in the [UTC time zone](https://en.wikipedia.org
### Fixed

- (Hardware controller) The pixel calibration values have been switched between the default v2.5 hardware config file and the default v2.6 hardware config file, so that each file has the correct pixel calibration. The default pscopehat hardware config file has also been updated to include the changes made to the default v2.6 hardware config file.
- (Breaking change; segmenter) The segmenter now runs as `root` (instead of `pi`) in the Docker container for it, so that it doesn't break on various actual & potential edge cases of files/directories being created with `root` ownership (rather than `pi` ownership) before being bind mounted into the container.

## v2024.0.0-alpha.0 - 2024-02-06

Expand Down
2 changes: 1 addition & 1 deletion control/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "planktoscope-controller"
# Note: PEP 440 requires pre-releases to be formatted like "2023.7.0b0" rather than
# "2023.7.0-beta.0", which is different from the Semantic Versioning schema
version = "2023.9.0"
version = "2024.0.0a0"
description = "Controller of PlanktoScope hardware"
# For simplicity, we follow the definition of "Maintainer" from
# https://opensource.guide/how-to-contribute/#anatomy-of-an-open-source-project , which says:
Expand Down
17 changes: 9 additions & 8 deletions processing/segmenter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ RUN \
rm -rf /var/lib/apt/lists/* && \
rm /tmp/apt-packages

# Drop root user

RUN useradd --create-home pi
USER pi:pi
# For now, we don't drop root because dirs are made as root by the hardware controller:
# USER pi:pi
RUN mkdir -p /home/pi/device-backend/processing/segmenter
WORKDIR /home/pi/device-backend/processing/segmenter

Expand All @@ -31,16 +30,18 @@ RUN \
poetry --no-interaction cache list && \
poetry --no-interaction cache clear pypi --all && \
poetry --no-interaction cache clear piwheels --all && \
rm -rf /home/pi/.cache/pypoetry/artifacts && \
rm -rf /home/pi/.cache/pypoetry/cache && \
rm -rf /root/.cache/pypoetry/artifacts && \
rm -rf /root/.cache/pypoetry/cache && \
pip cache purge && \
rm -rf /home/pi/.cache/pip
rm -rf /root/.cache/pip

# Set up application

# Note: we must explicitly set chown here, or else filfes will be copied with root permissions
# Note: we must explicitly set chown if we drop root, or else files will be copied with root
# permissions.
COPY --chown=pi:pi main.py .
COPY --chown=pi:pi planktoscope/ ./planktoscope
ENTRYPOINT ["/home/pi/.local/bin/poetry", "run", "python", "main.py"]
# ENTRYPOINT ["/home/pi/.local/bin/poetry", "run", "python", "main.py"]
ENTRYPOINT ["/usr/local/bin/poetry", "run", "python", "main.py"]
EXPOSE 8001
RUN mkdir -p /home/pi/device-backend-logs/processing/segmenter
2 changes: 1 addition & 1 deletion processing/segmenter/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "planktoscope-processing-segmenter"
# Note: PEP 440 requires pre-releases to be formatted like "2023.7.0b0" rather than
# "2023.7.0-beta.0", which is different from the Semantic Versioning schema
version = "2023.9.0"
version = "2024.0.0a0"
description = "Data processor to segment objects from raw PlanktoScope data"
# For simplicity, we follow the definition of "Maintainer" from
# https://opensource.guide/how-to-contribute/#anatomy-of-an-open-source-project , which says:
Expand Down