Skip to content

Commit 6eb4415

Browse files
committed
added a build arg to container files
1 parent 9516653 commit 6eb4415

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"include_webpages": ["n", "y"],
1515
"container_runtime": ["podman", "docker"],
1616
"__template_repo": "https://github.com/btr1975/cookiecutter-python-fastapi-openapi",
17-
"__template_version": "1.0.6",
17+
"__template_version": "1.0.7",
1818
"_new_lines":"\n",
1919
"_copy_without_render": [
2020
"{{cookiecutter.__app_name}}/templates",

{{cookiecutter.git_repo_name}}/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ build:
2424

2525
{% if cookiecutter.container_runtime == "podman" %}
2626
build-container:
27-
@cd containers && podman build --ssh=default -t {{ cookiecutter.git_repo_name }}:latest -f Containerfile
27+
@cd containers && podman build --ssh=default –build-arg=build_branch=main -t {{ cookiecutter.git_repo_name }}:latest -f Containerfile
2828
{% endif %}
2929

3030
{% if cookiecutter.container_runtime == "docker" %}
3131
build-container:
32-
@cd containers && docker build --ssh=default -t {{ cookiecutter.git_repo_name }}:latest -f Dockerfile
32+
@cd containers && docker build --ssh=default -t –build-arg=build_branch=main {{ cookiecutter.git_repo_name }}:latest -f Dockerfile
3333
{% endif %}
3434

3535
coverage:

{{cookiecutter.git_repo_name}}/containers/Containerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ RUN ${PIP_INSTALL_COMMAND} --upgrade pip setuptools wheel \
99

1010
FROM base AS final
1111

12+
ARG build_branch=main
13+
14+
ENV BUILD_BRANCH=${build_branch}
15+
1216
RUN --mount=type=ssh,required=true \
13-
${PIP_INSTALL_COMMAND} git+ssh://git@github.com/{{ cookiecutter.git_username }}/{{ cookiecutter.git_repo_name }}
17+
${PIP_INSTALL_COMMAND} git+ssh://git@github.com/{{ cookiecutter.git_username }}/{{ cookiecutter.git_repo_name }}@${BUILD_BRANCH}
1418

1519
EXPOSE 8080/tcp
1620

{{cookiecutter.git_repo_name}}/containers/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ RUN ${PIP_INSTALL_COMMAND} --upgrade pip setuptools wheel \
99

1010
FROM base AS final
1111

12+
ARG build_branch=main
13+
14+
ENV BUILD_BRANCH=${build_branch}
15+
1216
RUN --mount=type=ssh,required=true \
13-
${PIP_INSTALL_COMMAND} git+ssh://git@github.com/{{ cookiecutter.git_username }}/{{ cookiecutter.git_repo_name }}
17+
${PIP_INSTALL_COMMAND} git+ssh://git@github.com/{{ cookiecutter.git_username }}/{{ cookiecutter.git_repo_name }}@${BUILD_BRANCH}
1418

1519
EXPOSE 8080/tcp
1620

0 commit comments

Comments
 (0)