Skip to content

Commit 25a4dcb

Browse files
heredoc dockerfile poc
1 parent fd17593 commit 25a4dcb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Dockerfile.heredoc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# syntax = docker/dockerfile:1.4
2+
3+
ARG PYTHON_VERSION=3.10.9
4+
5+
FROM python:${PYTHON_VERSION}-slim-bullseye
6+
7+
ENV USER_NAME=${USER_NAME:-appuser}
8+
9+
# TODO: debug `<<-` heredoc operator
10+
RUN <<EOF
11+
#!/usr/bin/env python
12+
import os
13+
14+
user_name = os.getenv("USER_NAME", "")
15+
16+
try:
17+
if user_name != "":
18+
print(f"Hello {user_name}!")
19+
else:
20+
print("Hello world!")
21+
except NameError as e:
22+
pass
23+
finally:
24+
print("Nice to meet you!")
25+
26+
EOF
27+
28+
# ENTRYPOINT [ "/bin/bash" ]

0 commit comments

Comments
 (0)