Skip to content

Commit fcfb02d

Browse files
committed
refactor: migrate to python
1 parent 31e2dc7 commit fcfb02d

3 files changed

Lines changed: 25 additions & 11 deletions

File tree

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM dinutac/jinja2docker:2.1.3
22

3-
COPY entrypoint.sh /entrypoint.sh
3+
COPY entrypoint.py /entrypoint.py
44

5-
ENTRYPOINT ["/entrypoint.sh"]
5+
ENTRYPOINT ["/entrypoint.py"]

entrypoint.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import re
5+
import subprocess
6+
7+
flags = []
8+
9+
variables = re.compile('\n+', re.MULTILINE).sub(
10+
',',
11+
os.environ['INPUT_VARIABLES']
12+
)
13+
14+
if os.environ.get('INPUT_STRICT') == 'true':
15+
flags.append('--strict')
16+
17+
flags.extend([
18+
os.environ['INPUT_TEMPLATE'],
19+
'-D', variables,
20+
'-o', os.environ['INPUT_OUTPUT_FILE']
21+
])
22+
23+
subprocess.run(['jinja2'] + flags)

entrypoint.sh

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

0 commit comments

Comments
 (0)