Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

env:
DOCKER_ENV_REGISTRY: ${{ vars.DOCKER_ENV_REGISTRY }}
DOCKER_ENV_TAG: ${{ github.sha }}
DOCKER_ENV_BASE_TAG: ${{ github.sha }}

jobs:
tag_dev_image:
Expand All @@ -31,7 +31,7 @@ jobs:
run: |
RETRIES=3
while [ $RETRIES -gt 0 ]; do
if ./docker/env.sh pull; then
if ./docker/env.sh compose pull; then
exit 0
else
echo "Retrying in 1 minute"
Expand All @@ -41,8 +41,7 @@ jobs:
done
exit 1

- name: Tag dev env images with version
run: ./docker/env.sh tag ${{ github.ref_name }}

- name: Push tagged dev env images
run: ./docker/env.sh push
- name: Tag and push dev env images
run: |
./docker/env.sh tag ${{ github.ref_name }}
DOCKER_ENV_BASE_TAG=${{ github.ref_name }} ./docker/env.sh compose push
2 changes: 1 addition & 1 deletion .github/workflows/ci_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
run: ./docker/env.sh exec -- ./scripts/lint.sh

- name: Wind down docker-env
run: ./docker/env.sh down
run: ./docker/env.sh compose down
11 changes: 3 additions & 8 deletions .github/workflows/ci_master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ permissions:
env:
DOCKER_ENV_REGISTRY: ${{ vars.DOCKER_ENV_REGISTRY }}
DOCKER_ENV_BUILD_PLATFORMS: linux/arm64,linux/amd64
DOCKER_ENV_BUILD_TAGS: ${{ github.sha }}

jobs:
cache_dev_image:
Expand All @@ -33,11 +34,5 @@ jobs:
- name: Clone project
uses: actions/checkout@v4

- name: Build dev env images
run: ./docker/env.sh build

- name: Tag dev env images with commit
run: ./docker/env.sh tag ${{ github.sha }}

- name: Push tagged dev env images
run: ./docker/env.sh push
- name: Build, tag and push dev env images
run: ./docker/env.sh compose build --push
29 changes: 14 additions & 15 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,15 @@ You can customize the following environment variables:

<!-- markdownlint-disable MD013 -->

| var | default | description |
| ------------------------------------- | --------------------------------------------------- | ---------------------------------------------------------------- |
| `DOCKER_ENV_PROJECT_NAME` | Repository name | Name of your project (used to generated images and containers) |
| `DOCKER_ENV_PROJECT_ENV_FILE` | `$PWD/.env` | Local environment file |
| `DOCKER_ENV_PROJECT_DOCKER_DIRECTORY` | `$PWD/docker` | Project docker directory, where docker-env files are located |
| `DOCKER_ENV_PROJECT_COMPOSE_FILE` | `$DOCKER_ENV_PROJECT_DOCKER_DIRECTORY/compose.yaml` | The dev env compose file, where services are defined |
| `DOCKER_ENV_PROJECT_CACHE_DIRECTORY` | `$PWD/.cache/docker-env` | Where docker-env will store its generated files for your project |
| `DOCKER_ENV_PROJECT_DEFAULT_SERVICE` | dev | Default dev env service to use when unspecified |
| `DOCKER_ENV_BUILD_PLATFORMS` | - | Target platforms when building images |
| `DOCKER_ENV_REGISTRY` | - | Registry where built images will be pulled/pushed from/to |
| `DOCKER_ENV_TAG` | latest | Image tag to build/pull from registry |
| var | default | description |
| ------------------------------------ | ----------------------- | ---------------------------------------------------------------- |
| `DOCKER_ENV_PROJECT_NAME` | Repository name | Name of your project (used to generated images and containers) |
| `DOCKER_ENV_PROJECT_COMPOSE_FILE` | `./docker/compose.yaml` | The dev env compose file, where services are defined |
| `DOCKER_ENV_PROJECT_CACHE_DIRECTORY` | `./.cache/docker-env` | Where docker-env will store its generated files for your project |
| `DOCKER_ENV_PROJECT_DEFAULT_SERVICE` | dev | Default dev env service to use when unspecified |
| `DOCKER_ENV_BUILD_PLATFORMS` | - | Target platforms when building images |
| `DOCKER_ENV_REGISTRY` | - | Registry where built images will be pulled/pushed from/to |
| `DOCKER_ENV_BASE_TAG` | latest | Image tag to build/pull from registry |

These variables are readonly:

Expand Down Expand Up @@ -102,15 +100,16 @@ create containers, start them and open an interactive shell in the dev env conta
#### CI workflows

You can use `./docker/env.sh exec -- COMMAND` to build/pull images, create containers, start
them and execute a command in the dev env container. The `init`, `build`, `pull`, `push` and
`tag` subcommands, alongside some [environment variables](#environment-variables) can also be
used to craft efficient workflows.
them and execute a command in the dev env container. The `compose` and `tag` subcommands,
alongside some [environment variables](#environment-variables) can also be used to craft
efficient workflows.

> You can look at this repo's CI/CD workflows for inspiration

#### Winding down

When done, you can stop and remove the environment using `./docker/env.sh down`
When done, you can stop and remove the environment using `./docker/env.sh compose down` (like
any other docker compose environment)

## Contributors

Expand Down
Loading