Skip to content

Commit

Permalink
bug: fix docker permissions and missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
alastairtree committed Jul 29, 2024
1 parent 248c2d3 commit 01e568f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ To use WebPODA APIs, an access token needs to be defined in the environment as `
pre-commit install
```

5. To use the docker /data mount you need a folder on your WSL and a user with a given UID

```bash
# in WSL on your HOST
mkdir -p /mnt/imap-data
sudo adduser -u 5678 --disabled-password --gecos "" appuser
# you have created the user with the same UID as in the container. now grant the folder to the user
chown -R appuser:appuser /mnt/imap-data
```

### Build, pack and test

```bash
Expand Down
6 changes: 6 additions & 0 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ ENV PYTHONUNBUFFERED=1

COPY deploy/entrypoint.sh /app/entrypoint.sh
COPY *.yaml /app/

#TODO: this is a hack mounting the src folder to the container
COPY src/imap_mag/xtce/*.xml /app/src/imap_mag/xtce/

COPY dist/python${PYTHON_VERSION}/${TOOL_PACKAGE} /app/python${PYTHON_VERSION}/

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers

RUN adduser -u 5678 --disabled-password --gecos "" appuser && \
chown -R appuser /app && \
mkdir -p /data && \
chown -R appuser /data && \
chmod +x /app/entrypoint.sh

# Install the postgres client and any other dependencies needed to install our app
Expand Down
2 changes: 1 addition & 1 deletion run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ IMAGE_NAME="${IMAGE_NAME:-imap-pipeline-core/imap-mag}"
docker run --rm -it \
--entrypoint /bin/sh \
--env-file dev.env \
-v /data:/data \
-v /mnt/imap-data:/data \
$IMAGE_NAME

0 comments on commit 01e568f

Please sign in to comment.