Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python packaging conf and small fix / modif for building docker image #14

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM docker:24.0.8-dind

RUN apk add --no-cache python3 python3-dev py3-pip gcc jq \
git curl build-base autoconf automake py3-cryptography rsync \
linux-headers musl-dev libffi-dev openssl-dev openssh
FROM python:3.12-alpine AS builder

RUN python3 -m venv --upgrade-deps /opt/venv
RUN apk add --no-cache python3 python3-dev py3-pip gcc \
git curl build-base autoconf automake py3-cryptography \
linux-headers musl-dev libffi-dev openssl-dev

COPY requirements.txt /opt
COPY ansible_collection_helper.py /opt/
COPY templates /opt/templates/
COPY . /usr/local/src/ansible_collection_helper
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /build/wheels /usr/local/src/ansible_collection_helper

RUN /opt/venv/bin/pip install -r /opt/requirements.txt
FROM docker:24.0.8-dind
RUN apk add --no-cache python3 py3-pip jq py3-cryptography rsync openssh-client
COPY --from=builder /build/wheels /wheels
RUN python3 -m venv /opt/venv/
RUN /opt/venv/bin/pip install --no-cache-dir /wheels/*
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: 2024 Dalibo
#
# SPDX-License-Identifier: GPL-3.0-or-later
[build-system]
requires = ["setuptools >= 61.0", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "ansible_collection_helper"
description = "Helper to manage Ansible collection"
readme = "README.md"
requires-python = ">=3.11, <4"
license = { text = "GPLv3" }
authors = [{ name = "Dalibo SCOP", email = "[email protected]" }]
keywords = [
"ansible",
"command-line",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Topic :: System :: Systems Administration",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
]
dynamic = ["version", "dependencies"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[project.urls]
Source = "https://github.com/dalibo/docker-dind-molecule/"
Tracker = "https://github.com/dalibo/docker-dind-molecule/"


[project.scripts]
ansible_collection_helper = "ansible_collection_helper:helper.main"

[tool.setuptools_scm]
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ansible==8.6.1
ansible-compat==4.1.10
ansible-core==2.15.6
ansible-lint==6.22.0
ansible==8.6.1
codespell==2.2.6
distlib==0.3.8
molecule==6.0.2
molecule-plugins[docker]==23.5.0
molecule==6.0.2
pytest-testinfra==10.0.0
urllib3<2
yq==3.4.3
yq==3.4.3
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@

import yaml
from ansible.cli.doc import DocCLI
from jinja2 import Environment, FileSystemLoader
from jinja2 import Environment, PackageLoader

env = Environment(loader=FileSystemLoader((Path(__file__).parent / "templates")))
from . import __name__ as pkgname

env = Environment(
loader=PackageLoader(package_name=pkgname, package_path="templates"),
trim_blocks=True,
lstrip_blocks=True,
)
template = env.get_template("readme.jinja2")


Expand Down
File renamed without changes.