Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 1 | VERSION --use-copy-link 0.7 |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 2 | FROM python:3.10 |
| 3 | |
| 4 | poetry: |
Mohammed Naser | 32cb11e | 2023-04-28 21:49:51 +0000 | [diff] [blame] | 5 | RUN pip3 install poetry==1.4.2 |
| 6 | SAVE IMAGE --cache-hint |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 7 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 8 | build.wheels: |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 9 | FROM +poetry |
| 10 | COPY pyproject.toml poetry.lock ./ |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 11 | ARG --required only |
| 12 | RUN poetry export --only=${only} -f requirements.txt --without-hashes > requirements.txt |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 13 | RUN pip wheel -r requirements.txt --wheel-dir=/wheels |
| 14 | SAVE ARTIFACT requirements.txt |
| 15 | SAVE ARTIFACT /wheels |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 16 | SAVE IMAGE --cache-hint |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 17 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 18 | build.venv: |
| 19 | ARG --required only |
| 20 | FROM +build.wheels --only ${only} |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 21 | RUN python3 -m venv /venv |
| 22 | ENV PATH=/venv/bin:$PATH |
| 23 | RUN pip install -r requirements.txt |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 24 | SAVE IMAGE --cache-hint |
| 25 | |
| 26 | build.venv.dev: |
| 27 | FROM +build.venv --only main,dev |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 28 | SAVE ARTIFACT /venv |
| 29 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 30 | build.venv.runtime: |
| 31 | FROM +build.venv --only main |
| 32 | SAVE ARTIFACT /venv |
| 33 | |
| 34 | build.collections: |
| 35 | FROM +build.venv.runtime |
| 36 | COPY charts /src/charts |
| 37 | COPY meta /src/meta |
| 38 | COPY playbooks /src/playbooks |
| 39 | COPY plugins /src/plugins |
| 40 | COPY roles /src/roles |
| 41 | COPY galaxy.yml /src/galaxy.yml |
| 42 | RUN ansible-galaxy collection install --collections-path /usr/share/ansible/collections /src |
| 43 | SAVE ARTIFACT /usr/share/ansible/collections |
| 44 | SAVE IMAGE --cache-hint |
| 45 | |
| 46 | image: |
| 47 | FROM python:3.10-slim |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 48 | ENV ANSIBLE_PIPELINING=True |
Mohammed Naser | 9feca4b | 2023-05-19 16:17:40 -0400 | [diff] [blame] | 49 | RUN \ |
| 50 | apt-get update && \ |
Mohammed Naser | 92219f8 | 2023-05-23 13:15:08 -0400 | [diff] [blame] | 51 | apt-get install --no-install-recommends -y rsync openssh-client && \ |
Mohammed Naser | 9feca4b | 2023-05-19 16:17:40 -0400 | [diff] [blame] | 52 | apt-get clean && \ |
| 53 | rm -rf /var/lib/apt/lists/* |
Mohammed Naser | ebc3afb | 2023-05-31 14:08:01 -0400 | [diff] [blame] | 54 | CMD ["/bin/bash"] |
Mohammed Naser | e720d78 | 2023-07-10 15:57:21 -0400 | [diff] [blame^] | 55 | COPY +build.venv.runtime/venv /venv |
| 56 | ENV PATH=/venv/bin:$PATH |
| 57 | COPY +build.collections/ /usr/share/ansible |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 58 | ARG tag=latest |
Mohammed Naser | ccc70cc | 2023-04-28 22:20:34 +0000 | [diff] [blame] | 59 | SAVE IMAGE --push ghcr.io/vexxhost/atmosphere:${tag} |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 60 | |
| 61 | pin-images: |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 62 | FROM +build.venv.dev |
ricolin | b8ab017 | 2023-06-01 15:41:02 +0800 | [diff] [blame] | 63 | COPY roles/defaults/vars/main.yml /defaults.yml |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 64 | COPY build/pin-images.py /usr/local/bin/pin-images |
| 65 | RUN /usr/local/bin/pin-images /defaults.yml /pinned.yml |
ricolin | b8ab017 | 2023-06-01 15:41:02 +0800 | [diff] [blame] | 66 | SAVE ARTIFACT /pinned.yml AS LOCAL roles/defaults/vars/main.yml |
Mohammed Naser | d03bba3 | 2023-04-25 12:54:58 +0000 | [diff] [blame] | 67 | |
| 68 | gh: |
| 69 | FROM alpine:3 |
| 70 | RUN apk add --no-cache github-cli |
| 71 | |
| 72 | trigger-image-sync: |
| 73 | FROM +gh |
| 74 | ARG --required project |
| 75 | RUN --secret GITHUB_TOKEN gh workflow run --repo vexxhost/docker-openstack-${project} sync.yml |