File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash -xe
2
- CONTAINER=" ${USER} _pycontw_vm "
2
+ CONTAINER=" pycontw "
3
3
COMPOSE_FILE=" ./docker-compose-dev.yml"
4
4
5
5
# test if the container is running
14
14
15
15
if [ -n " $HASH " ]; then
16
16
echo " found existing running container $CONTAINER , proceeding to exec another shell"
17
- docker-compose -f $COMPOSE_FILE restart
18
- docker exec -w /app/src -it $HASH bash -c " SHELL=bash poetry shell"
17
+ docker-compose -f $COMPOSE_FILE exec -i $CONTAINER bash -c " SHELL=bash source /app/.venv/bin/activate && bash"
19
18
elif [ -n " $HASH_STOPPED " ]; then
20
19
echo " found existing stopped container $CONTAINER , starting"
21
- docker-compose -f $COMPOSE_FILE restart
22
- docker start --attach -i $HASH_STOPPED
20
+ ( docker-compose -f $COMPOSE_FILE restart && docker start $HASH_STOPPED ) > /dev/null 2>&1
21
+ docker-compose -f $COMPOSE_FILE exec -i $CONTAINER bash -c " SHELL=bash source /app/.venv/bin/activate && bash "
23
22
else
24
23
echo " existing container not found, creating a new one, named $CONTAINER "
25
- docker-compose -f $COMPOSE_FILE pull
26
- docker-compose -f $COMPOSE_FILE run -p 8000:8000 --name= $CONTAINER pycontw bash -c " SHELL=bash poetry shell "
24
+ docker-compose -f $COMPOSE_FILE up --build --remove-orphans -d
25
+ docker-compose -f $COMPOSE_FILE exec -i $CONTAINER bash -c " SHELL=bash source /app/.venv/bin/activate && bash "
27
26
fi
28
27
echo " see you, use 'docker rm $CONTAINER ' to kill the dev container or 'docker-compose -f $COMPOSE_FILE down' to kill both the postgres and the dev container if you want a fresh env next time"
You can’t perform that action at this time.
0 commit comments