softplayer-ansible/Containerfile

34 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-03-28 17:29:07 +00:00
FROM python:3.12.2-slim-bullseye AS compile-image
RUN apt-get update
RUN apt-get install -y --no-install-recommends build-essential gcc libffi-dev git vim ssh
RUN mkdir ~/.ssh
COPY ./resources/known_hosts ~/.ssh/known_hosts
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.yml .
RUN pip install hcloud ansible
RUN ansible-galaxy install -r ./requirements.yml --force
FROM ghcr.io/allanger/dumb-downloader as dudo
ARG SOPS_VERSION=v3.8.1
ENV RUST_LOG=info
RUN mkdir -p /out
RUN dudo -l "https://github.com/getsops/sops/releases/download/{{ version }}/sops-{{ version }}.{{ os }}.{{ arch }}" -d /out/sops -p $SOPS_VERSION
RUN chmod +x /out/sops
2024-05-07 12:16:57 +00:00
FROM mikefarah/yq as yq
WORKDIR /out
RUN cp $(which yq) .
2024-03-28 17:29:07 +00:00
FROM python:3.12.2-slim-bullseye AS build-image
COPY --from=compile-image /opt/venv /opt/venv
RUN apt-get update && \
2024-04-02 12:12:22 +00:00
apt-get install age ssh git -y
2024-03-28 17:29:07 +00:00
COPY . /src
2024-05-07 12:16:57 +00:00
COPY --from=yq /out/yq /usr/bin/yq
2024-03-28 17:29:07 +00:00
COPY --from=dudo /out/sops /usr/bin/sops
ENV PATH="/opt/venv/bin:$PATH"
2024-04-02 11:58:33 +00:00
RUN ansible-galaxy install -r /src/requirements.yml --force
2024-03-28 17:29:07 +00:00
CMD ['ansible']