Skip to content

Commit 67a6c2a

Browse files
committed
Move env build to Dockerfile; Remove now unnecessary actions steps
1 parent 979f470 commit 67a6c2a

File tree

4 files changed

+22
-41
lines changed

4 files changed

+22
-41
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,5 @@
5858
"--security-opt=label=disable"
5959
],
6060
// Mount the parent as /workspaces so we can pip install peers as editable
61-
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
62-
// After the container is created, install the python project in editable form
63-
"postCreateCommand": "bash ./.devcontainer/post-install.sh"
61+
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind"
6462
}

.devcontainer/post-install.sh

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

.github/actions/install_requirements/action.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ inputs:
44
python-version:
55
description: Python version to install, default is from Dockerfile
66
default: "dev"
7-
poetry-version:
8-
description: Poetry version to install, from pyproject.toml
9-
default: $(yq '.project."optional-dependencies".dev[] | select(. | contains("poetry"))' pyproject.toml | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
107

118
runs:
129
using: composite
@@ -20,25 +17,15 @@ runs:
2017
echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV"
2118
shell: bash
2219

23-
- name: Setup python
24-
uses: actions/setup-python@v5
20+
- name: Setup PDM
21+
uses: pdm-project/setup-pdm@v4
2522
with:
2623
python-version: ${{ env.PYTHON_VERSION }}
2724

28-
- name: Install Poetry
29-
uses: abatilo/actions-poetry@v2
30-
with:
31-
poetry-version: ${{ inputs.poetry-version }}
32-
33-
# - name: Install Poetry with specific version from pyproject.toml
34-
# uses: snok/install-poetry@v1
35-
# with:
36-
# poetry-version-from-pyproject-toml: true
37-
3825
- name: Install dependencies
39-
run: poetry install --no-root
26+
run: pdm sync -d --no-root
4027
shell: bash
4128

4229
- name: Report what was installed
43-
run: poetry show
30+
run: pdm show
4431
shell: bash

Dockerfile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ RUN curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm
1010
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq \
1111
&& chmod +x /usr/bin/yq
1212

13-
COPY . ./
14-
COPY src/phoebus_guibuilder ./phoebus_guibuilder
15-
RUN touch README.md
16-
17-
# # Set up a virtual environment and put it in PATH
18-
# RUN python -m venv /venv
19-
# ENV PATH=/venv/bin:$PATH
20-
2113
# # The build stage installs the context into the venv
22-
# FROM developer AS build
23-
# COPY . /context
24-
# WORKDIR /context
25-
# RUN touch dev-requirements.txt && pip install -c dev-requirements.txt .
14+
FROM developer AS build
15+
# install PDM
16+
RUN pip install -U pdm
17+
# disable update check
18+
ENV PDM_CHECK_UPDATE=false
19+
# copy files
20+
COPY pyproject.toml pdm.lock README.md /project/
21+
COPY src/ /project/src
22+
23+
# install dependencies and project into the local packages directory
24+
WORKDIR /project
25+
RUN pdm install --check --prod --no-editable
2626

27-
# # The runtime stage copies the built venv into a slim runtime container
28-
# FROM python:${PYTHON_VERSION}-slim AS runtime
29-
# # Add apt-get system dependecies for runtime here if needed
30-
# COPY --from=build /venv/ /venv/
31-
# ENV PATH=/venv/bin:$PATH
27+
# The runtime stage copies the built venv into a slim runtime container
28+
FROM python:${PYTHON_VERSION}-slim AS runtime
29+
# Add apt-get system dependecies for runtime here if needed
30+
COPY --from=builder /project/.venv/ /project/.venv
31+
ENV PATH="/project/.venv/bin:$PATH"
3232

3333
# change this entrypoint if it is not the same as the repo
3434
ENTRYPOINT ["phoebus-guibuilder"]

0 commit comments

Comments
 (0)