modelw-docker


Namemodelw-docker JSON
Version 2023.7.1 PyPI version JSON
download
home_pagehttps://github.com/ModelW/docker/
SummaryUtility to simplify Dockerfiles
upload_time2023-07-13 08:00:45
maintainer
docs_urlNone
authorRémy Sanchez
requires_python>=3.10,<4.0
licenseWTFPL
keywords docker django nuxt dockerfile
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Model W Docker

A tool so that your Dockerfile looks like this:

```Dockerfile
FROM modelw/base:2023.03

COPY --chown=user package.json package-lock.json ./

RUN modelw-docker install

COPY --chown=user . .

RUN modelw-docker build

CMD ["modelw-docker", "serve"]
```

## Organization

This repository contains different elements that work together, found in
sub-directories here:

-   `src` &mdash; Contains the source of the `modelw-docker` package, that is
    published on Pypi.
-   `image` &mdash; Is the source for the Docker image that can be used as a
    base for all Model&nbsp;W projects.
-   `demo` &mdash; A demo project used to test the image during development

## `modelw-docker`

This is a helper that is pre-installed in the Docker image and helps you build
and run a Model&nbsp;W project.

If called from the root of a project, it will automatically detect the project's
type and run appropriate commands for each step of the build. If later on the
way the Docker image is built or the requirements of Model&nbsp;W change, it is
expected that those changes can be reflected in the `modelw-docker` package
without requiring the developers to change their Dockerfiles.

### Available actions

-   `modelw-docker install` &mdash; Installs the project's dependencies (creates
    the virtualenv, runs `npm install` or whatever is required). It only
    requires the dependencies files to run (`package.json`/`package-lock.json`
    for front components, `pyproject.toml`/`poetry.lock` for api components).
-   `modelw-docker build` &mdash; Builds the project. It requires the project to
    be installed first. It also requires all the source code to be present.
-   `modelw-docker serve` &mdash; Runs the project. It requires the project to
    be installed and built first.
-   `modelw-docker run` &mdash; Runs a command in the project's virtualenv. It
    requires the project to be installed first.

The reason why `install` and `build` are separate and why you need first to copy
just the dependencies list and then the source code is to allow for caching of
the dependencies. This way, the dependencies are only re-installed when the
dependencies list changes, not when the source code changes. This makes very
fast builds when only the source code changes.

### Dry run

There is a `--dry-run` option for all the commands that will just print what
would have been done but not do it. The dry run mode is automatically enabled if
you run the package outside of Docker in order to avoid fucking up your desktop.

### Config file

All the settings are automatically detected, however if something isn't to your
taste you can always override it using a `model-w.toml` file, following this
structure:

```toml
[project]
# For printing purposes
name = "demo_project"
# Either "front" or "api"
component = "api"

[project.required_files]
# All the files to be created before the install step and their content
"src/demo_project/__init__.py" = ""

[apt.repos]
# APT repositories to be added, you need to give both the source and the key
# for each one of them
pgdg.source = "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main"
pgdg.key = { url = "https://www.postgresql.org/media/keys/ACCC4CF8.asc" }

[apt.packages]
# APT packages to be installed. Put * to install the default version, or a
# version number to install a specific version.
gdal-bin = "*"
```

In addition, Python project also have the following settings:

```toml
[project]
# [...]
# Either "gunicorn" or "daphne"
server = "daphne"

# Modules that have the WSGI and ASGI entry points
wsgi = "demo_project.django.wsgi:application"
asgi = "demo_project.django.asgi:application"
```

## Contribution

The Docker image and the package are auto-built and published on Docker Hub and
Pypi respectively. The build is triggered by pushing a tag to the repository
(for the Python package) and for each branch's head (for the Docker image).

If you want to make a release, the Makefile will help you:

```bash
make release VERSION=2022.10.0
```

This will use Git Flow to make the release, and then also make sure to update
the version in the Dockerfile and the `modelw-docker` package.

Once this is done, you have to:

-   Push the tag to the repository
-   Push develop and master
-   Make sure you update support branches accordingly (this cannot be automated
    it's a human decision)

> **Note** &mdash; If you're releasing a new major version of Model&nbsp;W, you
> need to update the `image/Dockerfile` to match the new "upper" version limit.
> This script will only update the "lower" version limit, to make sure the image
> is built with the package you just released.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ModelW/docker/",
    "name": "modelw-docker",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "docker,django,nuxt,dockerfile",
    "author": "R\u00e9my Sanchez",
    "author_email": "remy.sanchez@hyperthese.net",
    "download_url": "https://files.pythonhosted.org/packages/37/b8/d6b8f2227519c80fccfc1dbae56162ba7bf0a76cbf07b2834a49bbe998a4/modelw_docker-2023.7.1.tar.gz",
    "platform": null,
    "description": "# Model W Docker\n\nA tool so that your Dockerfile looks like this:\n\n```Dockerfile\nFROM modelw/base:2023.03\n\nCOPY --chown=user package.json package-lock.json ./\n\nRUN modelw-docker install\n\nCOPY --chown=user . .\n\nRUN modelw-docker build\n\nCMD [\"modelw-docker\", \"serve\"]\n```\n\n## Organization\n\nThis repository contains different elements that work together, found in\nsub-directories here:\n\n-   `src` &mdash; Contains the source of the `modelw-docker` package, that is\n    published on Pypi.\n-   `image` &mdash; Is the source for the Docker image that can be used as a\n    base for all Model&nbsp;W projects.\n-   `demo` &mdash; A demo project used to test the image during development\n\n## `modelw-docker`\n\nThis is a helper that is pre-installed in the Docker image and helps you build\nand run a Model&nbsp;W project.\n\nIf called from the root of a project, it will automatically detect the project's\ntype and run appropriate commands for each step of the build. If later on the\nway the Docker image is built or the requirements of Model&nbsp;W change, it is\nexpected that those changes can be reflected in the `modelw-docker` package\nwithout requiring the developers to change their Dockerfiles.\n\n### Available actions\n\n-   `modelw-docker install` &mdash; Installs the project's dependencies (creates\n    the virtualenv, runs `npm install` or whatever is required). It only\n    requires the dependencies files to run (`package.json`/`package-lock.json`\n    for front components, `pyproject.toml`/`poetry.lock` for api components).\n-   `modelw-docker build` &mdash; Builds the project. It requires the project to\n    be installed first. It also requires all the source code to be present.\n-   `modelw-docker serve` &mdash; Runs the project. It requires the project to\n    be installed and built first.\n-   `modelw-docker run` &mdash; Runs a command in the project's virtualenv. It\n    requires the project to be installed first.\n\nThe reason why `install` and `build` are separate and why you need first to copy\njust the dependencies list and then the source code is to allow for caching of\nthe dependencies. This way, the dependencies are only re-installed when the\ndependencies list changes, not when the source code changes. This makes very\nfast builds when only the source code changes.\n\n### Dry run\n\nThere is a `--dry-run` option for all the commands that will just print what\nwould have been done but not do it. The dry run mode is automatically enabled if\nyou run the package outside of Docker in order to avoid fucking up your desktop.\n\n### Config file\n\nAll the settings are automatically detected, however if something isn't to your\ntaste you can always override it using a `model-w.toml` file, following this\nstructure:\n\n```toml\n[project]\n# For printing purposes\nname = \"demo_project\"\n# Either \"front\" or \"api\"\ncomponent = \"api\"\n\n[project.required_files]\n# All the files to be created before the install step and their content\n\"src/demo_project/__init__.py\" = \"\"\n\n[apt.repos]\n# APT repositories to be added, you need to give both the source and the key\n# for each one of them\npgdg.source = \"deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main\"\npgdg.key = { url = \"https://www.postgresql.org/media/keys/ACCC4CF8.asc\" }\n\n[apt.packages]\n# APT packages to be installed. Put * to install the default version, or a\n# version number to install a specific version.\ngdal-bin = \"*\"\n```\n\nIn addition, Python project also have the following settings:\n\n```toml\n[project]\n# [...]\n# Either \"gunicorn\" or \"daphne\"\nserver = \"daphne\"\n\n# Modules that have the WSGI and ASGI entry points\nwsgi = \"demo_project.django.wsgi:application\"\nasgi = \"demo_project.django.asgi:application\"\n```\n\n## Contribution\n\nThe Docker image and the package are auto-built and published on Docker Hub and\nPypi respectively. The build is triggered by pushing a tag to the repository\n(for the Python package) and for each branch's head (for the Docker image).\n\nIf you want to make a release, the Makefile will help you:\n\n```bash\nmake release VERSION=2022.10.0\n```\n\nThis will use Git Flow to make the release, and then also make sure to update\nthe version in the Dockerfile and the `modelw-docker` package.\n\nOnce this is done, you have to:\n\n-   Push the tag to the repository\n-   Push develop and master\n-   Make sure you update support branches accordingly (this cannot be automated\n    it's a human decision)\n\n> **Note** &mdash; If you're releasing a new major version of Model&nbsp;W, you\n> need to update the `image/Dockerfile` to match the new \"upper\" version limit.\n> This script will only update the \"lower\" version limit, to make sure the image\n> is built with the package you just released.\n",
    "bugtrack_url": null,
    "license": "WTFPL",
    "summary": "Utility to simplify Dockerfiles",
    "version": "2023.7.1",
    "project_urls": {
        "Documentation": "https://github.com/ModelW/docker/",
        "Homepage": "https://github.com/ModelW/docker/",
        "Repository": "https://github.com/ModelW/docker/"
    },
    "split_keywords": [
        "docker",
        "django",
        "nuxt",
        "dockerfile"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a40849cd7489625e708e5a810e952c418e41c3d71d6e9cde5c8beb06b971fd2f",
                "md5": "015e7f9ff440812ed42b795b485240c0",
                "sha256": "b54017aec009580b2269f3fa21ba4c73e5ff53317e7769a1ed7ed2d0fa6b93f0"
            },
            "downloads": -1,
            "filename": "modelw_docker-2023.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "015e7f9ff440812ed42b795b485240c0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 16380,
            "upload_time": "2023-07-13T08:00:43",
            "upload_time_iso_8601": "2023-07-13T08:00:43.621246Z",
            "url": "https://files.pythonhosted.org/packages/a4/08/49cd7489625e708e5a810e952c418e41c3d71d6e9cde5c8beb06b971fd2f/modelw_docker-2023.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37b8d6b8f2227519c80fccfc1dbae56162ba7bf0a76cbf07b2834a49bbe998a4",
                "md5": "e3488427e2c7d474bd8272aff87d8b29",
                "sha256": "fbbd0d24485695a245941e688b8298af57a8e5c96ee53a3755530633a9e27a75"
            },
            "downloads": -1,
            "filename": "modelw_docker-2023.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e3488427e2c7d474bd8272aff87d8b29",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 14508,
            "upload_time": "2023-07-13T08:00:45",
            "upload_time_iso_8601": "2023-07-13T08:00:45.453011Z",
            "url": "https://files.pythonhosted.org/packages/37/b8/d6b8f2227519c80fccfc1dbae56162ba7bf0a76cbf07b2834a49bbe998a4/modelw_docker-2023.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-13 08:00:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ModelW",
    "github_project": "docker",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "modelw-docker"
}
        
Elapsed time: 0.23155s