Skip to content

Commit 7a64ef2

Browse files
committed
update readme, add online-installer
1 parent 23119ac commit 7a64ef2

File tree

107 files changed

+72
-4792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+72
-4792
lines changed

.devops/docker/alias/node/Dockerfile

Lines changed: 0 additions & 7 deletions
This file was deleted.

.devops/docker/alias/node/build.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ build
77
dist
88
*.spec
99
.env
10-
*.zip
11-
/docker-alaias
10+
/ocker-alias/
11+
docker-alias.zip
1212
__pycache__

README.md

Lines changed: 48 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,65 @@
11
# docker-alias
22

3-
Aliases for docker
4-
This will hook into the cd command and look for a docker-alias.yml.
5-
The services in it get extracted and a bash alias is generated.
3+
Enables you to use docker-containers to execute commands as if they where installed on your system.
64

7-
Now you can use "containerized"-tools as if they where installed on your host-machine.
8-
9-
It also exports some handy environment variables:
10-
* PROJECT_ROOT_PATH - the path where the docker-alias.yml is stored
11-
* LOCAL_UID - the executers uid
12-
* LOCAL_GID - the executers gid
5+
### Requirements:
6+
- docker
7+
- systemd
8+
- lebokus/bindfs:latest (optional)
139

1410
### Installation
1511

16-
Clone this repo onto your desired destination and source the auto-docker-alias file in your .bashrc or .zshrc:
17-
18-
```
19-
source /path/to/repo/auto-docker-alias.sh
20-
PATH=$PATH:/path/to/repo
21-
```
12+
`wget -q -O - "https://raw.githubusercontent.com/clecherbauer/docker-alias/2.0.0/online-installer.sh" | bash`
2213

2314
### Usage
2415

25-
Create a docker-compose.alias.yml file and define your services:
26-
```
27-
<<< docker-alias.yml >>>
28-
version: '3'
29-
30-
services:
31-
node:
32-
image: node:4
33-
volumes:
34-
- ${PROJECT_ROOT_DIR}:/app
35-
working_dir: /app
36-
labels:
37-
- com.docker-alias.name=npm
38-
```
39-
40-
There are following labels available:
41-
42-
`com.docker-alias.name=npm` - the alias name and command
43-
44-
`com.docker-alias.name=[node, npm, vue]` - multiple alias names and commands
45-
46-
`com.docker-alias.command=/bin/bash` - [Optional] the command wich should be executed in the service, if empty the name will be used as the command
47-
48-
`com.docker-alias.service=node` - [Optional] the service wich should be used, if not set the service in wich this label appears is used
16+
1. create a new docker-alias.yml and define your volumes and commands:
4917

50-
`com.docker-alias.user=www-data` - [Optional] the user wich should be used to execute the service
51-
52-
`com.docker-alias.keepRoot=true` - [Optional] the command is executed in the services defined workdirectory
53-
54-
`com.docker-alias.detach=true` - [Optional] start the service detached
55-
56-
`com.docker-alias.silent=true` - [Optional] silents the services stdout and stderr
57-
58-
`com.docker-alias.preExecutionCommand` - [Optional] the command is executed on the host before the service starts
59-
60-
61-
Now cd into the path with the docker-alias.yml and type docker-alias
62-
63-
### Tips and Tricks
64-
65-
Avoid file-permission problems with the [lebokus/bindfs](https://github.com/lebokus/docker-volume-bindfs) docker plugin.
6618
```
67-
<<< docker-alias.yml >>>
68-
version : '3'
69-
7019
volumes:
71-
alias_bindfs_mapped_data:
20+
bindfs:
7221
driver: lebokus/bindfs:latest
73-
labels:
74-
- com.docker-alias=true
7522
driver_opts:
76-
sourcePath: "${PROJECT_ROOT_PATH}"
77-
map: "${LOCAL_UID}/0:@${LOCAL_UID}/@0"
23+
sourcePath: "$YAML_LOCATION_DIR"
24+
map: "$UID/0:@$UID/@0"
25+
26+
containers:
27+
python:
28+
build:
29+
context: .
30+
dockerfile: .devops/docker/alias/python/Dockerfile
31+
volumes:
32+
- bindfs:$DEFAULT_WORKING_DIR
33+
- $SSH_AUTH_SOCK:/ssh-auth.sock
34+
commands:
35+
- python
36+
- pip3:
37+
path: /usr/local/bin/pip3
38+
- flake8
39+
- autopep8
40+
- prospector
41+
- prospector-html
42+
env_file: .env
43+
environment:
44+
- PYTHONPATH=$DEFAULT_WORKING_DIR
45+
entrypoint: /usr/local/bin/entrypoint.sh
7846
79-
services:
8047
node:
81-
image: node:4
48+
image: node
8249
volumes:
83-
- alias_bindfs_mapped_data:/app
84-
working_dir: /app
85-
labels:
86-
- com.docker-alias.name=node
87-
```
50+
- bindfs:$DEFAULT_WORKING_DIR
51+
- $SSH_AUTH_SOCK:/ssh-auth.sock
52+
commands:
53+
- node
54+
- npm
55+
- npx
56+
- vue
57+
env_file: .env
58+
environment:
59+
- SSH_AUTH_SOCK=/ssh-auth.sock
60+
```
61+
62+
2. register your new docker-alias.yml with `docker-alias add`
63+
64+
3. try out your commands
65+

daemon.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,7 @@ def run(self):
7373
if __name__ == '__main__':
7474
try:
7575
Daemon().run()
76-
except(KeyboardInterrupt, SystemExit):
76+
except KeyboardInterrupt:
7777
pass
78+
except Exception as exception:
79+
print(exception)

docker-alias.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ volumes:
55
sourcePath: "$YAML_LOCATION_DIR"
66
map: "$UID/0:@$UID/@0"
77

8-
keep_volumes: False
9-
auto_rebuild_images: True
10-
118
containers:
129
python:
1310
build:
@@ -30,24 +27,8 @@ containers:
3027
quiet: false
3128
pre_exec_hook_command: ''
3229
post_exec_hook_command: ''
33-
env_file: .env
3430
user: root
3531
environment:
3632
- SSH_AUTH_SOCK=/ssh-auth.sock
3733
- PYTHONPATH=$DEFAULT_WORKING_DIR
3834
entrypoint: /usr/local/bin/entrypoint.sh
39-
40-
node:
41-
build:
42-
context: .
43-
dockerfile: .devops/docker/alias/node/Dockerfile
44-
working_dir: /app
45-
volumes:
46-
- bindfs:/app
47-
- $SSH_AUTH_SOCK:/ssh-auth.sock
48-
commands:
49-
- node
50-
- npm
51-
env_file: .env
52-
environment:
53-
- SSH_AUTH_SOCK=/ssh-auth.sock
-182 KB
Binary file not shown.
-42.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)