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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ itkdev-docker-compose-server
node_modules
dist
.pkg-cache
.task
21 changes: 15 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
23 changes: 11 additions & 12 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@ 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

dev:compile:
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion src/modules/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Loading