|
1 | | -ARG PYTHON_VERSION=3.10 |
| 1 | +FROM python:3.10-slim-bookworm |
| 2 | +ARG WORK_DIR="/opt/psr" |
2 | 3 |
|
3 | | -FROM python:${PYTHON_VERSION} |
| 4 | +WORKDIR ${WORK_DIR} |
4 | 5 |
|
5 | | -RUN set -ex; \ |
6 | | - apt-get update; \ |
7 | | - apt-get install -y --no-install-recommends \ |
8 | | - git-lfs |
| 6 | +ENV PSR_VENV_BIN="${WORK_DIR}/.venv/bin" |
9 | 7 |
|
10 | | -#install backported stable vesion of git, which supports ssh signing |
11 | | -RUN echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list; \ |
12 | | - apt-get update;\ |
13 | | - apt-get install -y git/bullseye-backports \ |
14 | | - && apt-get clean \ |
15 | | - && rm -rf /var/lib/apt/lists/*; \ |
16 | | - mkdir /semantic-release |
| 8 | +COPY . ./ |
17 | 9 |
|
18 | | -WORKDIR /semantic-release |
| 10 | +RUN \ |
| 11 | + # Install required os packages |
| 12 | + apt update && apt install -y --no-install-recommends \ |
| 13 | + git git-lfs python3-venv \ |
| 14 | + # Create virtual environment |
| 15 | + && python3 -m venv "$(dirname "${PSR_VENV_BIN}")" \ |
| 16 | + # Update local pip and built tools |
| 17 | + && "${PSR_VENV_BIN}/pip" install --upgrade --no-cache-dir pip setuptools wheel \ |
| 18 | + # Install semantic-release (/root/.local/bin) |
| 19 | + && "${PSR_VENV_BIN}/pip" install --pre --no-cache-dir -r requirements.txt \ |
| 20 | + # Validate binary availability |
| 21 | + && bash -c "${PSR_VENV_BIN}/semantic-release --help" \ |
| 22 | + # make action script executable |
| 23 | + && chmod +x "${WORK_DIR}/action.sh" \ |
| 24 | + # Put action script in PATH |
| 25 | + && ln -s "${WORK_DIR}/action.sh" /usr/local/bin/action-entrypoint \ |
| 26 | + # Clean up |
| 27 | + && apt clean && rm -rf /var/lib/apt/lists/* \ |
| 28 | + && find /tmp -mindepth 1 -delete |
19 | 29 |
|
20 | | -COPY action.sh /semantic-release/action.sh |
21 | | - |
22 | | -RUN pip install --pre --no-cache-dir "python-semantic-release<9"; \ |
23 | | - semantic-release --help |
24 | | - |
25 | | -ENTRYPOINT ["/semantic-release/action.sh"] |
| 30 | +ENTRYPOINT ["/usr/local/bin/action-entrypoint"] |
0 commit comments