Skip to content

Commit cdda8f6

Browse files
authored
share venv with other users (#103)
* share venv with other users * fix: ci * fix: ci * fix: ci
1 parent b7ff43c commit cdda8f6

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ jobs:
5555
mkdir -p "$CACHE_DIR"
5656
docker save ${{ steps.image_tag.outputs.TAG }} > ${{ steps.image_tag.outputs.TAR_PATH }}
5757
58+
- name: Install dependencies in container
59+
run: |
60+
docker run --rm -v ${{ github.workspace }}:/app -w /app --entrypoint /bin/bash ${{ steps.image_tag.outputs.TAG }} -c "
61+
export LANG=C.UTF-8 && pipenv install -e .
62+
"
5863
- name: Run tests in container
5964
run: |
6065
# Change owner of workspace to ubuntu user

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ RUN chmod +x /app/create_user.sh
3131
RUN chmod +x /app/entrypoint.sh
3232

3333
# install package
34-
RUN pipenv --python 3 && pipenv run pip install -e .
34+
ENV PIPENV_VENV_IN_PROJECT=1
35+
RUN pipenv install --dev --python 3 && \
36+
pipenv run pip install -e .
37+
ENV VIRTUAL_ENV=/app/.venv
3538

3639
EXPOSE 22
3740

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ The below command is connecting to `localhost` with user `docker` through port `
104104
```shell
105105
ssh docker@localhost -p 2222
106106

107-
# make sure installing the package first
108-
cd /app
109-
pipenv run pip install -e .
107+
# it will automatically enter venv in /app folder
108+
# then run rapida command
109+
rapida --help
110110
```
111111

112112
### destroy docker container

create_user.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ else
2020
# Grant sudo access (optional)
2121
usermod -aG sudo "$USERNAME"
2222
echo "User $USERNAME granted sudo privileges."
23-
fi
2423

25-
# Set ownership of /app folder to the user
26-
chown -R "$USERNAME:$USERNAME" /app
27-
echo "Ownership of /app granted to $USERNAME."
24+
echo "cd /app; pipenv shell;" >> /home/$USERNAME/.bashrc
25+
echo "User $USERNAME profile was modified to launch venv in starting."
26+
fi

0 commit comments

Comments
 (0)