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

Run server entrypoint as non-root #376

Merged
merged 1 commit into from
Apr 5, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 0 additions & 20 deletions docker/docker-compose.yml

This file was deleted.

6 changes: 6 additions & 0 deletions docker/server/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SEEREP_DATA_FOLDER=/mnt/seerep_data/
SEEREP_LOG_PATH=/mnt/seerep_data/log/
SEEREP_LOG_LEVEL=info
TZ=Europe/Berlin
USER_ID=1000
GROUP_ID=1000
4 changes: 2 additions & 2 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# base container with all necessary dependencies
ARG IMAGEBASE
ARG IMAGEBASETAG
FROM $IMAGEBASE:$IMAGEBASETAG

USER root

WORKDIR /seerep

COPY certs src/certs/
Expand All @@ -13,7 +13,7 @@ COPY seerep_msgs src/seerep_msgs/
COPY seerep_ros src/seerep_ros/
COPY seerep_srv src/seerep_srv/
COPY examples src/examples/
COPY docker/start_server.sh src/start_server.sh
COPY docker/server/start_server.sh src/start_server.sh

RUN /bin/bash -c "source /opt/ros/noetic/setup.bash; catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release; catkin build"

Expand Down
26 changes: 26 additions & 0 deletions docker/server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
services:
change_vol_ownership:
image: alpine:3.19
user: root
volumes:
- seerep_data:${SEEREP_DATA_FOLDER}
- seerep_log:${SEEREP_LOG_PATH}
command: chown -R ${USER_ID}:${GROUP_ID} ${SEEREP_DATA_FOLDER} ${SEEREP_LOG_PATH}
seerep:
image: ghcr.io/agri-gaia/seerep_base:latest
user: "${USER_ID}:${GROUP_ID}"
tty: true
container_name: seerep_server
env_file:
.env
ports:
- 9090:9090
volumes:
- seerep_data:${SEEREP_DATA_FOLDER}
- seerep_log:${SEEREP_LOG_PATH}
depends_on:
change_vol_ownership:
condition: service_completed_successfully
volumes:
seerep_data:
seerep_log:
File renamed without changes.