Simple declarative syntax for your projects tasks.
sdev.sh attempts to standardize and improve documentation on how projects are built and run when using docker-compose. It's a simple starting for someone new to a project.
npm install -g sdev.sh
sdev.sh uses a declarative yaml file (.sdev.yml) in the root of your repository to understand what tasks are available inside your project.
Some common actions that probably show up on every project when using docker-compose are:
- server (start the web development server)
- build (building your application or library)
- test (running your test suite)
- bash (ssh in the docker container used as your runtime)
Those tasks are expressed with the following definition:
version: 1 name: My Cool App description: This text should briefly mention what the application/library is about docker: compose_file: docker/docker-compose.yml tasks: - name: server description: Start the development server command: yarn start container: app ports: "8080:8080" - name: build description: This command will build the entire application and install dependencies command: yarn build container: app rm: true - name: test description: run unit test suite. command: yarn test container: app environment: - "NODE_ENV=test" - name: bash description: ssh in docker container command: /bin/bash container: app volumes: - "/npm/modules:/var/www/app/node_modules"
We can customize the tasks dependencies in terms of ports, volumes and environment variables.
The previous definition will generate the following output when calling
sdev without any arguments:
➜ sdev.sh git:(improve-readme) ✗ sdev Usage: sdev [options] [command] This text should briefly mention what the application/library is about Options: -V, --version output the version number -h, --help output usage information Commands: build This command will build the entire application and install dependencies test run unit test suite. bash ssh in docker container help [cmd] display help for [cmd]
The definition file should be straight forward and mimic
docker-compose as much as possible. Generally, tasks should be simple commands that you run in the container with some ports, environment and volumes variations.
Note: docker-compose inovations will use the
-pflag to scope containers to your project. This is very useful when you use a common docker folder for all your projects.
The sdev file version. Always 1
The name of your application/library. Not used at the moment but probably in the future.
A brief description of your application/library. This is used when showing the help command.
Relative path to .sdev.yaml for docker-compose file.
The name of the task. This name will be used for invoking the command
A brief description of what the task does.
The run command and args to use
The target container of the command
Array of volumes to attach when running
Array of environment variables to use when running
Array of ports to bind when running
Delete container after tasks ends
- Martín Fernández email@example.com