From 05cd02118ac808a816a218c9c5972568143c09e6 Mon Sep 17 00:00:00 2001 From: Ashish Jullia Date: Wed, 30 Sep 2026 15:05:59 -0400 Subject: [PATCH 1/2] Document named dev containers. Co-Authored-By: Claude Sonnet 5.5 --- Readme.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Readme.md b/Readme.md index cfa6660..dc48eb9 100644 --- a/Readme.md +++ b/Readme.md @@ -19,11 +19,34 @@ function dev() { docker_cmd+=" -e PORTUNUS_TOKEN=${PORTUNUS_TOKEN}/$1" fi + # Name the container dev-- (or dev-) so it can be found with docker ps / docker exec + local base name n=1 + if [ "$#" -eq 1 ]; then + base="dev-${1%%/*}-${1#*/}" + else + base="dev-$(basename "$PWD")" + fi + base=${base//[^a-zA-Z0-9_.-]/-} + name=$base + while sudo docker ps --format '{{.Names}}' | grep -qx "$name"; do n=$((n+1)); name="$base-$n"; done + docker_cmd+=" --name $name --hostname $name" + docker_cmd+=" --entrypoint /script.sh ashishjullia19/docker-dev-env" eval $docker_cmd } ``` +## Container names + +Each container is named `dev--` (or `dev-` when run without a project). If that name is already running, `-2`, `-3` and so on are added. The name is also the hostname, so the shell prompt shows which container you are in. + +```bash +docker ps --filter name=dev- +docker exec -it /script.sh +``` + +A plain `docker exec -it bash` does not see the Portunus variables, because `script.sh` exports them only into the shell it starts. Run `/script.sh` through `docker exec` to get the same environment. It asks for the MFA code again when the project has `AWS_MFA_SERIAL`. + ## With portunus integration: For `PORTUNUS_TOKEN` make sure to grab this from portunus ui `portunus.ashishjullia.com` and you'll get the token in format: From 2154a7abcd4a04663e230ab8b781c270da9965cd Mon Sep 17 00:00:00 2001 From: Ashish Jullia Date: Wed, 30 Sep 2026 15:05:59 -0400 Subject: [PATCH 2/2] Republish the image only when files it contains change. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/docker-build-push.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index a3d2335..0fab970 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -3,6 +3,15 @@ on: pull_request: push: branches: [ "main" ] + # Only files that end up in the image republish it. Pull requests stay + # unfiltered so the required "build" check always reports. + paths: + - 'Dockerfile' + - 'script.sh' + - 'mfa.sh' + - 'aws-role-credentials' + - 'aws-mfa-session' + - '.github/workflows/docker-build-push.yml' tags: - 'prod-*' env: