2024-02-28 16:27:06 +00:00
|
|
|
# Build container
|
|
|
|
# =================================
|
|
|
|
FROM python:3.11 AS build
|
|
|
|
|
|
|
|
RUN python -m pip install pip --upgrade
|
|
|
|
RUN curl -sSL -o /install-poetry.py https://install.python-poetry.org
|
|
|
|
RUN python /install-poetry.py --yes
|
|
|
|
|
|
|
|
ADD . /build
|
|
|
|
WORKDIR /build
|
|
|
|
|
|
|
|
RUN /root/.local/bin/poetry self add poetry-plugin-export
|
|
|
|
RUN /root/.local/bin/poetry export \
|
|
|
|
--format requirements.txt \
|
|
|
|
--output /build/requirements.txt \
|
|
|
|
--without-hashes
|
|
|
|
RUN python -m pip wheel \
|
|
|
|
--wheel-dir /build/wheels \
|
|
|
|
--requirement /build/requirements.txt \
|
|
|
|
--disable-pip-version-check \
|
|
|
|
--no-cache-dir
|
|
|
|
|
|
|
|
|
|
|
|
# Runtime container
|
|
|
|
# ==================================
|
|
|
|
FROM python:3.11-slim
|
|
|
|
|
2024-02-28 18:29:20 +00:00
|
|
|
ARG OPENTOFU_VERSION
|
|
|
|
ARG SEMAPHORE_VERSION
|
|
|
|
|
2024-02-28 16:27:06 +00:00
|
|
|
COPY --from=build /build/wheels /tmp/wheels
|
|
|
|
|
|
|
|
RUN apt-get update --yes && \
|
|
|
|
apt-get install --yes \
|
|
|
|
openssh-client \
|
|
|
|
apt-transport-https \
|
|
|
|
ca-certificates \
|
|
|
|
curl \
|
|
|
|
gnupg && \
|
|
|
|
mkdir --parents /tmp/apt && \
|
2024-02-28 18:29:20 +00:00
|
|
|
curl -sSL -o /tmp/apt/opentofu.deb https://github.com/opentofu/opentofu/releases/download/v${OPENTOFU_VERSION}/tofu_${OPENTOFU_VERSION}_amd64.deb && \
|
|
|
|
curl -sSL -o /tmp/apt/semaphore.deb https://github.com/ansible-semaphore/semaphore/releases/download/v${SEMAPHORE_VERSION}/semaphore_${SEMAPHORE_VERSION}_linux_amd64.deb && \
|
2024-02-28 16:27:06 +00:00
|
|
|
apt-get install --yes /tmp/apt/*.deb && \
|
|
|
|
apt-get clean --yes && \
|
|
|
|
rm -rf /tmp/apt && \
|
|
|
|
python -m pip install /tmp/wheels/*.whl \
|
|
|
|
--upgrade \
|
|
|
|
--pre \
|
|
|
|
--no-index \
|
|
|
|
--no-cache-dir \
|
|
|
|
--find-links /tmp/wheels \
|
|
|
|
--disable-pip-version-check && \
|
2024-02-28 18:33:28 +00:00
|
|
|
rm -rf /tmp/wheels
|
2024-02-28 16:27:06 +00:00
|
|
|
|
|
|
|
ADD entrypoint.sh /entrypoint.sh
|
|
|
|
ADD configure.py /configure.py
|
|
|
|
|
2024-02-28 18:33:28 +00:00
|
|
|
VOLUME /semaphore
|
|
|
|
|
2024-02-28 16:27:06 +00:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|