Skip to content

Commit b8874f7

Browse files
authored
🐛 fix reverse bug
1 parent 933c141 commit b8874f7

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

nb_cli_plugin_docker/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ async def generate(cwd: Path, venv: bool, force: bool):
121121
help="Force to re-generate the Dockerfile.",
122122
)
123123
@click.argument("compose_args", nargs=-1)
124+
@click.pass_context
124125
@run_async
125126
async def up(
126127
ctx: click.Context, cwd: Path, venv: bool, force: bool, compose_args: List[str]

nb_cli_plugin_docker/handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
),
3131
enable_async=True,
3232
)
33+
templates.globals.update(cli_templates.globals)
34+
templates.filters.update(cli_templates.filters)
3335

3436

3537
@dataclass

nb_cli_plugin_docker/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
def install():
99
cli_ = cast(CLIMainGroup, cli)
1010
cli_.add_command(docker)
11-
cli_.add_aliases("docker", ["deploy"])
11+
cli_.add_aliases("docker", ["deploy", "compose"])

nb_cli_plugin_docker/template/docker/forward.Dockerfile.jinja

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{% from "docker/_helpers.Dockerfile.jinja" import requirements_stage, reverse_config -%}
2-
# syntax=docker/dockerfile:1
32

43
{{ requirements_stage(python_version, build_backend) }}
54

@@ -13,7 +12,7 @@ ENV PYTHONPATH=/app
1312
COPY --from=requirements_stage /tmp/bot.py /app
1413

1514
{% if build_backend %}
16-
COPY --from=build-stage /wheel /wheel
15+
COPY --from=requirements_stage /wheel /wheel
1716
RUN pip install --no-cache-dir --no-index --find-links=/wheel -r /wheel/requirements.txt && rm -rf /wheel
1817
{% endif %}
1918

nb_cli_plugin_docker/template/docker/reverse.Dockerfile.jinja

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{% from "docker/_helpers.Dockerfile.jinja" import requirements_stage -%}
2-
# syntax=docker/dockerfile:1
32

43
{{ requirements_stage(python_version, build_backend) }}
54

6-
FROM python:{{ python_version }}
5+
FROM python:{{ python_version }}-slim
76

87
WORKDIR /app
98

109
ENV TZ Asia/Shanghai
1110
ENV PYTHONPATH=/app
1211

13-
COPY ./docker/_main.py ./docker/gunicorn_conf.py ./docker/start.sh /
12+
COPY ./docker/gunicorn_conf.py ./docker/start.sh /
13+
RUN chmod +x /start.sh
1414

1515
ENV APP_MODULE _main:app
1616
ENV MAX_WORKERS 1
1717

1818
COPY --from=requirements_stage /tmp/bot.py /app
19-
19+
COPY ./docker/_main.py /app
2020
{% if build_backend %}
21-
COPY --from=build-stage /wheel /wheel
21+
COPY --from=requirements_stage /wheel /wheel
2222
{% endif %}
2323

2424
RUN pip install --no-cache-dir gunicorn uvicorn[standard]{% if build_backend %} \

0 commit comments

Comments
 (0)