-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (42 loc) · 1.7 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
FROM python:3.12.3-alpine3.18 AS base
### Build the Ansible runtime
FROM base AS builder
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
PATH="$PATH:/runtime/bin" \
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.12/site-packages" \
# Versions:
POETRY_VERSION=1.7.1
# System deps:
RUN apk add build-base unzip wget python3-dev libffi-dev
RUN pip install "poetry==$POETRY_VERSION"
WORKDIR /src
# Generate requirements and install *all* dependencies.
COPY pyproject.toml poetry.lock /src/
RUN poetry export --dev --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
### Final container
FROM base AS runtime
COPY --from=builder /runtime /usr/local
COPY . /playbook
WORKDIR /playbook
ENV PATH="$PATH:/runtime/bin"
# Install git, roles and collections
RUN apk add git openssh-client make && ansible-galaxy role install -r requirements.yml --force && ansible-galaxy collection install -r requirements.yml --force
CMD [ "ansible-playbook", "--version" ]
# Labels.
LABEL maintainer="[email protected]" \
org.label-schema.schema-version="1.0" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.name="dimension-sh/infra" \
org.label-schema.description="Dimension Infrastructure playbooks in Docker" \
org.label-schema.url="https://github.com/dimension-sh/infra" \
org.label-schema.vcs-url="https://github.com/dimension-sh/infra" \
org.label-schema.vendor="Dimension"