diff --git a/.gitignore b/.gitignore index d704bb4..ee1b67c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ itkdev-docker-compose-server node_modules dist .pkg-cache +.task diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c739ca..f004159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,29 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.15] - 2026-06-16 + +* [PR-12](https://github.com/itk-devops/devops_itkdev-docker-server/pull/12) + Clean up Taskfile and dev tooling for `docker compose`. +* [PR-11](https://github.com/itk-devops/devops_itkdev-docker-server/pull/11) + Propagate command exit code instead of swallowing failed docker compose + commands. + ## [0.0.14] - 2025-03-26 -* [PR-10](https://github.com/itk-dev/economics/pull/1) +* [PR-10](https://github.com/itk-devops/devops_itkdev-docker-serverpull/1) Re-Update to node:18, re-update dependencies ## [0.0.13] - 2025-03-26 -* [PR-9](https://github.com/itk-dev/economics/pull/9) +* [PR-9](https://github.com/itk-devops/devops_itkdev-docker-serverpull/9) Roll back to node:16 and dependencies lock from 0.0.9. ## [0.0.12] - 2025-03-26 -* [PR-8](https://github.com/itk-dev/economics/pull/8) +* [PR-8](https://github.com/itk-devops/devops_itkdev-docker-serverpull/8) Fix binary non uploaded as release asset ## [0.0.11] - 2025-03-26 -* [PR-7](https://github.com/itk-dev/economics/pull/7) +* [PR-7](https://github.com/itk-devops/devops_itkdev-docker-serverpull/7) Fix path in build action ## [0.0.10] - 2025-03-26 -* [PR-5](https://github.com/itk-dev/economics/pull/5) +* [PR-5](https://github.com/itk-devops/devops_itkdev-docker-serverpull/5) Update to node:18, update dependencies Update docker setup Update github actions @@ -55,7 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.0.1] - 2022-04-22 -[Unreleased]: https://github.com/itk-dev/economics/compare/0.0.14...HEAD +[Unreleased]: https://github.com/itk-devops/devops_itkdev-docker-server/compare/0.0.15...HEAD +[0.0.15]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.15 [0.0.14]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.14 [0.0.13]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.13 [0.0.12]: https://github.com/itk-devops/devops_itkdev-docker-server/releases/tag/0.0.12 diff --git a/README.md b/README.md index 6f51b0f..91688df 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,18 @@ # Docker compose server -Simple wrapper around docker compose + +Simple wrapper around `docker compose`. > [!WARNING] > ## Needs refactor > We depend on the archived and unmaintained [pkg](https://www.npmjs.com/package/pkg). Pkg recommends Node.js 21’s > support for [single executable applications](https://nodejs.org/api/single-executable-applications.html) as an > possible alternative. + +## Development + +``` shell +task dev:install +task dev:build +``` + +Run `task dev:build --force` to force a rebuild of the `itkdev-docker-compose-server` binary. diff --git a/Taskfile.yml b/Taskfile.yml index 441cac2..ad97071 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,15 +2,9 @@ version: '3' dotenv: [".task.env"] -vars: - # Docker file selection - DOCKER_COMPOSE_FILES_OSX: '{{if eq OS "darwin"}}-f docker-compose.mac-nfs.yml{{end}}' - DOCKER_COMPOSE_FILES_DEFAULT: '-f docker-compose.yml {{ .DOCKER_COMPOSE_FILES_OSX }}' - DOCKER_COMPOSE_FILES: '{{.DOCKER_COMPOSE_FILES | default .DOCKER_COMPOSE_FILES_DEFAULT }}' - tasks: dev:install: - summary: Install node packages + desc: Install node packages cmds: - task dev:cli -- npm install @@ -18,16 +12,21 @@ tasks: task dev:cli -- node_modules/.bin/tsc dev:build: - summary: Build MacOS-x64 test build + desc: Build itkdev-docker-compose-server binary for local testing cmds: - - task dev:cli -- npm run buildTest + - task dev:cli -- npm run build:macos + sources: + - '*.json' + - 'src/**/*.ts' + generates: + - itkdev-docker-compose-server dev:cli: - summary: Performs command inside container. Expects parameter(s). + desc: Performs command inside container. Expects parameter(s). cmds: - - docker compose {{ .DOCKER_COMPOSE_FILES }} run --rm node {{.CLI_ARGS}} + - docker compose run --rm node {{.CLI_ARGS}} build: - summary: Build linux-x64 + desc: Build linux-x64 for production cmds: - task dev:cli -- npm run build diff --git a/package.json b/package.json index e884f07..d3f8b8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "itkdev-docker-server", - "version": "0.0.14", + "version": "0.0.15", "description": "Docker compose server site helper", "bin": "dist/index.js", "main": "dist/index.js", @@ -23,7 +23,7 @@ }, "scripts": { "build": "node_modules/.bin/tsc && node_modules/.bin/pkg --targets node18-linux-x64 --output assets/itkdev-docker-compose-server .", - "buildTest": "node_modules/.bin/tsc && node_modules/.bin/pkg --targets node18-macos-x64 --output itkdev-docker-compose-server ." + "build:macos": "node_modules/.bin/tsc && node_modules/.bin/pkg --targets node18-macos-x64 --output itkdev-docker-compose-server ." }, "devDependencies": { "@types/node": "^17.0.33", diff --git a/src/commands/docker.ts b/src/commands/docker.ts index dba5787..05850f0 100644 --- a/src/commands/docker.ts +++ b/src/commands/docker.ts @@ -13,8 +13,8 @@ exports.handler = function (argv: { [x: string]: any; base: string; debug: any; // Test env file exists. if (!utils.isFile(argv.base + '/' + env)) { - console.error('The env file not found!'); - return; + console.error(`The env (${env}) file not found!`); + process.exit(1); } // Hack to parse the commands that should be sendt to docker. diff --git a/src/modules/docker.ts b/src/modules/docker.ts index a937652..4867096 100644 --- a/src/modules/docker.ts +++ b/src/modules/docker.ts @@ -83,7 +83,11 @@ export default class Docker { if (err instanceof Error) { console.error(err.message); } - return null; + + // Propagate the failed command's exit code so callers (CI, Ansible) + // detect the failure instead of seeing a false success. + const status = (err as {status?: number | null}).status; + process.exit(typeof status === 'number' ? status : 1); } } }