File tree Expand file tree Collapse file tree 3 files changed +44
-6
lines changed
Expand file tree Collapse file tree 3 files changed +44
-6
lines changed Original file line number Diff line number Diff line change 2727 - name : Setup poetry
2828 run : |
2929 poetry config virtualenvs.in-project true
30- poetry install --no-dev
30+ poetry install
3131 - name : Build package
3232 run : |
3333 poetry shell
Original file line number Diff line number Diff line change 1+ # Build stage
2+ FROM python:3.11-slim AS builder
3+
4+ # Install poetry
5+ RUN pip install poetry
6+
7+ WORKDIR /app
8+
9+ # Copy the entire project
10+ COPY . .
11+
12+ # Configure poetry to create the virtualenv inside the project directory
13+ RUN poetry config virtualenvs.in-project true
14+
15+ # Install dependencies without installing the project itself
16+ RUN poetry install --no-root --no-interaction --no-ansi
17+
18+ # Runtime stage
19+ FROM python:3.11-slim
20+
21+ WORKDIR /app
22+
23+ # Copy only the necessary files from builder
24+ COPY --from=builder /app/.venv .venv
25+ COPY --from=builder /app/app ./app
26+
27+ # Set PATH to use the virtualenv
28+ ENV PATH="/app/.venv/bin:$PATH"
29+
30+ # Set the entrypoint to run the CLI
31+ ENTRYPOINT ["python" , "-m" , "app" ]
Original file line number Diff line number Diff line change 1- .PHONY : all poetry_install dependencies git_hooks_init
1+ .PHONY : all python-poetry python- dependencies git-hooks-init
22
3- all : poetry_install dependencies git_hooks_init
3+ all : python-poetry python- dependencies git-hooks-init
44 echo " ---- Your working directory is all set :) ----"
55
6- poetry_install :
6+ python-poetry :
77 @echo " ---- Installing Python Poetry ----"
88 pip install -U pip
99 pip install -U poetry
1010 poetry config virtualenvs.in-project true
1111 poetry config virtualenvs.path " .venv"
1212
13- dependencies : poetry_install
13+ python- dependencies : python-poetry
1414 @echo " ---- Installing Python dependencies ----"
1515 poetry install
1616 poetry self add poetry-plugin-sembump
1717
18- git_hooks_init :
18+ git-hooks-init :
1919 @echo " ---- Git hooks init (using Gookme) ----"
2020 curl -sSL https://raw.githubusercontent.com/LMaxence/gookme/main/scripts/install.sh | bash
2121 gookme init --all
2222
23+ .PHONY : build
24+
25+ build :
26+ docker build -t app-cli .
27+
28+ run :
29+ docker run app-cli
You can’t perform that action at this time.
0 commit comments