-
Notifications
You must be signed in to change notification settings - Fork 23
/
Dockerfile
74 lines (59 loc) · 1.68 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
ARG PYTHON_VERSION=3.11.7-slim-bookworm
FROM python:${PYTHON_VERSION} AS builder
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=true \
POETRY_VIRTUALENVS_IN_PROJECT=true
ARG BUILD_DEPS="\
docker \
gcc \
libc-dev \
libffi-dev \
make \
musl-dev \
openssh-client \
"
RUN apt-get update && \
apt-get install --no-install-recommends -y ${BUILD_DEPS} && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
pip install \
--upgrade \
pip \
poetry \
setuptools \
wheel
RUN --mount=type=cache,mode=0755,target=/root/.cache/pypoetry \
poetry install \
--without dev \
--no-root
##################
# runtime
##################
FROM python:${PYTHON_VERSION} AS runtime
LABEL "maintainer"="Evgenii Vasilenko <gmrnsk@gmail.com>"
LABEL "repository"="https://github.com/gofrolist/molecule-action"
LABEL "com.github.actions.name"="molecule"
LABEL "com.github.actions.description"="Run Ansible Molecule"
LABEL "com.github.actions.icon"="upload"
LABEL "com.github.actions.color"="green"
ENV PATH="/app/.venv/bin:$PATH"
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
ARG PACKAGES="\
docker.io \
git \
openssh-client \
podman \
rsync \
tini \
"
RUN apt-get update && \
apt-get install --no-install-recommends -y ${PACKAGES} && \
rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD cd ${INPUT_MOLECULE_WORKING_DIR}; molecule ${INPUT_MOLECULE_OPTIONS} ${INPUT_MOLECULE_COMMAND} ${INPUT_MOLECULE_ARGS}