Skip to content

Commit 5aedb68

Browse files
a-l-a-oChristian Bartels
authored andcommitted
Improve Docker setup:
* Add rootless 'jira' user * Switch to multi-stage build * Add configuration options via build args for: * Timezone * Shell * Editor * UID && GID
1 parent ee4364d commit 5aedb68

13 files changed

Lines changed: 350 additions & 34 deletions

File tree

.ashrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Aliases for bash, zsh and ash
2+
alias w='txt2jira'
3+
alias ws='txt2jira log'
4+
alias wl='txt2jira list'
5+
alias wd='txt2jira delete'
6+
alias wt='txt2jira time'
7+
alias wi='txt2jira issue'
8+
alias wc='txt2jira comment'
9+
alias e='exit'

.bashrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Aliases for bash, zsh and ash
2+
alias w='txt2jira'
3+
alias ws='txt2jira log'
4+
alias wl='txt2jira list'
5+
alias wd='txt2jira delete'
6+
alias wt='txt2jira time'
7+
alias wi='txt2jira issue'
8+
alias wc='txt2jira comment'
9+
alias e='exit'

.config/fish/config.fish

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
if status is-interactive
2+
# Commands to run in interactive sessions can go here
3+
4+
# aliases for fish
5+
alias w 'txt2jira'
6+
alias ws 'txt2jira log'
7+
alias wl 'txt2jira list'
8+
alias wd 'txt2jira delete'
9+
alias wt 'txt2jira time'
10+
alias wi 'txt2jira issue'
11+
alias wc 'txt2jira comment'
12+
alias e 'exit'
13+
14+
end

.config/fish/fish_variables

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This file contains fish universal variable definitions.
2+
# VERSION: 3.0
3+
SETUVAR __fish_initialized:3400
4+
SETUVAR fish_color_autosuggestion:555\x1ebrblack
5+
SETUVAR fish_color_cancel:\x2dr
6+
SETUVAR fish_color_command:blue
7+
SETUVAR fish_color_comment:red
8+
SETUVAR fish_color_cwd:green
9+
SETUVAR fish_color_cwd_root:red
10+
SETUVAR fish_color_end:green
11+
SETUVAR fish_color_error:brred
12+
SETUVAR fish_color_escape:brcyan
13+
SETUVAR fish_color_history_current:\x2d\x2dbold
14+
SETUVAR fish_color_host:normal
15+
SETUVAR fish_color_host_remote:yellow
16+
SETUVAR fish_color_normal:normal
17+
SETUVAR fish_color_operator:brcyan
18+
SETUVAR fish_color_param:cyan
19+
SETUVAR fish_color_quote:yellow
20+
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
21+
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
22+
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
23+
SETUVAR fish_color_status:red
24+
SETUVAR fish_color_user:brgreen
25+
SETUVAR fish_color_valid_path:\x2d\x2dunderline
26+
SETUVAR fish_key_bindings:fish_default_key_bindings
27+
SETUVAR fish_pager_color_completion:normal
28+
SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di
29+
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
30+
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
31+
SETUVAR fish_pager_color_selected_background:\x2dr

.docker/Dockerfile

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

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
.idea
2+
vendor
3+
.phpunit.result.cache
4+
.txt2jira*
5+
.ash_history
6+
.local
7+
archive
8+
.git
9+
.composer
10+
!.txt2jira

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
vendor
22
.phpunit.result.cache
33
tests/txt2jira.log
4+
.txt2jira*
5+
.ash_history
6+
.local
7+
.composer
8+
archive

.zshrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Aliases for bash, zsh and ash
2+
alias w='txt2jira'
3+
alias ws='txt2jira log'
4+
alias wl='txt2jira list'
5+
alias wd='txt2jira delete'
6+
alias wt='txt2jira time'
7+
alias wi='txt2jira issue'
8+
alias wc='txt2jira comment'
9+
alias e='exit'

README.md

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ All done!
131131
* CURL
132132

133133
### Installation
134-
134+
#### Native Installation
135135
```bash
136136
git clone https://github.com/klammbueddel/txt2jira
137137
cd txt2jira
@@ -154,8 +154,128 @@ alias wd='txt2jira delete'
154154
alias wt='txt2jira time'
155155
alias wi='txt2jira issue'
156156
alias wc='txt2jira comment'
157+
alias e='exit'
158+
```
159+
160+
### Docker Installation
161+
162+
Clone the repository:
163+
164+
```bash
165+
git clone https://github.com/klammbueddel/txt2jira.git
166+
cd txt2jira
167+
```
168+
169+
#### Configuration
170+
171+
Customize the application by adjusting build arguments in the `docker-compose.yml` file:
172+
173+
- **`_shell`**: Shell to use inside the container (default: `ash`)
174+
- **`_editor`**: Text editor to install (default: `vi`)
175+
- **`_tz`**: Timezone for the container (default: `UTC`)
176+
177+
Example `docker-compose.yml` build args:
178+
179+
```yaml
180+
build:
181+
context: .
182+
dockerfile: ./docker/Dockerfile
183+
target: prod
184+
args:
185+
- _shell=fish
186+
- _editor=nano
187+
- _tz=Europe/Berlin
188+
command: fish
189+
```
190+
191+
Get the vendor folder to be able to mount this directory as a volume into the jira container and
192+
uncomment volumes in the `docker-compose.yml`.
193+
194+
```bash
195+
# Run this inside the cloned repository
196+
docker compose run --build --rm -v "$(pwd):/jira" app "sed -i '24s/ #/ /; 25s/ #/ /' /jira/docker-compose.yml && cp -vR vendor /jira"
197+
```
198+
199+
#### Running the Application
200+
201+
Build and run the application using Docker Compose:
202+
203+
```bash
204+
docker compose run --rm -ti --build app
205+
```
206+
207+
This command:
208+
209+
- Builds the Docker image with your specified settings.
210+
- Runs the container interactively.
211+
212+
#### Alias Suggestions
213+
214+
To simplify commands, create aliases:
215+
216+
**For Bash and Zsh:**
217+
218+
```bash
219+
alias wb='docker compose build'
220+
alias w='docker compose run --rm -ti app'
221+
```
222+
223+
**For Fish Shell:**
224+
225+
```bash
226+
alias wb 'docker compose build'
227+
alias w 'docker compose run --rm -ti app'
228+
```
229+
230+
Now you can:
231+
232+
- Build the container with `wb`.
233+
- Run the container with `w`.
234+
235+
#### Running from Any Directory
236+
237+
To run these commands from any directory without specifying the path to `docker-compose.yml`, set the `COMPOSE_FILE` environment variable.
238+
239+
**For Bash and Zsh:**
240+
241+
```bash
242+
# Adjust this path to your clone dir
243+
export COMPOSE_FILE="$(pwd)/docker-compose.yml"
157244
```
158245

246+
**For Fish Shell:**
247+
248+
```bash
249+
# Adjust this path to your clone dir
250+
set -x COMPOSE_FILE "$(pwd)/docker-compose.yml"
251+
```
252+
253+
This points Docker Compose to your `docker-compose.yml` file, allowing you to use the aliases from any location.
254+
255+
#### Using the Application
256+
257+
With the aliases and configurations set, you can:
258+
259+
- **Build the container:**
260+
261+
```bash
262+
wb
263+
```
264+
265+
- **Run the container:**
266+
267+
```bash
268+
w
269+
```
270+
271+
This starts the container with your specified shell and settings, without needing to provide the shell or directory each time.
272+
273+
#### Notes
274+
275+
- **Shell and Editor Options:** Common shells include `ash`, `bash`, `fish`, and `zsh`. Editors include `vi`, `nano`, and `vim`.
276+
- **Timezone Configuration:** Use valid [timezone identifiers](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) for the `_tz` argument.
277+
- **Persistent Aliases:** Add the aliases to your shell's configuration file (`~/.bashrc`, `~/.zshrc`, or `~/.config/fish/config.fish`) to make them persistent.
278+
159279
## Other features
160280

161281
### Aliases

docker-compose.ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
---
2-
version: '3'
3-
41
services:
52

63
app:
74
build:
85
context: .
9-
dockerfile: ./.docker/Dockerfile
6+
dockerfile: ./docker/Dockerfile

0 commit comments

Comments
 (0)