{"id":13824908,"url":"https://github.com/gkpln3/Sand","last_synced_at":"2025-07-08T20:32:29.257Z","repository":{"id":86878389,"uuid":"527480685","full_name":"gkpln3/Sand","owner":"gkpln3","description":"Python based Dockerfile generator","archived":false,"fork":false,"pushed_at":"2023-12-05T21:46:16.000Z","size":40,"stargazers_count":26,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-07T07:47:06.261Z","etag":null,"topics":["docker","docker-generator","dockerfile","dockerfiles"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gkpln3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-08-22T08:44:06.000Z","updated_at":"2025-03-12T13:17:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"5b028ef3-8639-4385-a0e9-2fa0540b8fcb","html_url":"https://github.com/gkpln3/Sand","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/gkpln3/Sand","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkpln3%2FSand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkpln3%2FSand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkpln3%2FSand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkpln3%2FSand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gkpln3","download_url":"https://codeload.github.com/gkpln3/Sand/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkpln3%2FSand/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264343754,"owners_count":23593786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-generator","dockerfile","dockerfiles"],"created_at":"2024-08-04T09:01:11.583Z","updated_at":"2025-07-08T20:32:28.807Z","avatar_url":"https://github.com/gkpln3.png","language":"Python","readme":"# Sand 🏝\n[![.github/workflows/ci.yml](https://github.com/gkpln3/Sand/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/gkpln3/Sand/actions/workflows/ci.yml)\n\nSand is a Dockerfile generator.\n\nIt allows you to write cleaner, shorter and more configurable Dockerfiles.\n\n## Developers ❤️ Sand\nSand is built by developers, for developers. It's built to be as simple as possible, while still being super useful.\n\n## Installation\nYou can install Sand using pip.\n```bash\npip3 install docker-sand\n```\n\n## Features\n✅ Simple, easy to learn syntax based on Python.\n\n✅ Configurable Dockerfiles. \n\n✅ Share code between Dockerfiles.\n\n✅ Perfect for monorepos composed of multiple microservices.\n\n✅ Supports multi-stage builds.\n\n\n#### Planned Features:\n    \n🔘 Optimize builds by finding common layers between Dockerfiles, and merging them into a base image.\n\n🔘 Minimizing the number of layers by combining multiple RUN commands into one.    \n\n\n# Example\nWrite your Dockerfile in a Python-like syntax.\n```python\n# Sandfile\nfrom sand import *\n\nFrom(\"ubuntu\", Tag=\"20.04\")\nRun([\n    \"apt-get update\",\n    \"apt-get install ffmpeg python3\"\n])\n\n# Install python debugger on debug images.\nif config.DEBUG:\n    Run(\"pip3 install pdb\")\n\nCopy(\"app\", \"/app\")\nEntrypoint(\"python3 /app/app.py\")\n```\n⬇️\n```dockerfile\n# Auto-generated by Sand, do not edit!\nFROM ubuntu:20.04\nRUN apt-get update\nRUN apt-get install ffmpeg python3\nCOPY app /app\nENTRYPOINT python3 /app/app.py\n```\n\n### Share Code\nBecause `Sandfile`s are just Python files, and are being evaluated in an hierarchical manner by using the `Sand` directive, you can easily share code between them.\n\nGiven the following directory structure:\n```\nmy-monorepo/\n│\n├── tweet-service/\n|   ├── src/\n|   ├── ...\n│   └── Sandfile\n│\n├── home-timeline/\n|   ├── src/\n|   ├── ...\n│   └── Sandfile\n│\n└── Sandfile\n```\nYou can write your `Sandfile`s like this:\n```python\n# ./my-monorepo/Sandfile\nfrom sand import *\n\ndef MyService(name):\n    From(\"ubuntu\", \"20.04\")\n    Run(\"apt-get install python3\")\n    Copy(Src=\"src\", Dst=\"/app\")\n    Entrypoint(f\"python3 /app/{name}.py\")\n\nSand(\"tweet-service\")\nSand(\"home-timeline\")\n```\n```python\n# ./my-monorepo/tweet-service/Sandfile\nfrom sand import *\n\nMyService(\"tweet-service\") # Defined in ../Sandfile\n```\n\n```python\n# ./my-monorepo/home-timeline/Sandfile\nfrom sand import *\n\nMyService(\"home-timeline\") # Defined in ../Sandfile\n```\n\nThis allows you to share code between your Dockerfiles, and keep them [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself).\n\nThis is similar to the way `add_subdirectory` works in [CMake](https://cmake.org/)\n\n\n## Usage\nRunning Sand is as simple as running `sand` in your terminal.\nThis will generate Dockerfiles for all Sandfiles in the current directory.\n```\n$ sand config\nSaving Dockerfile to backend/service1/Dockerfile\nSaving Dockerfile to backend/service2/Dockerfile\nBuilt successfully!\n```\nYou can also watch for changes and automatically rebuild your Dockerfiles.\n```\n$ sand config -w\nWatching for changes...\n```\n\n### Configuration\nYou can pass configuration values to Sand using the `-D` or `--set` flag.\n```\n$ sand config -DDEBUG=True\n```\nOr use a YAML file.\n```yaml\n# sand.yaml\nDEBUG: True\n```\n```\n$ sand config --values sand.yaml\n```\n\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkpln3%2FSand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgkpln3%2FSand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkpln3%2FSand/lists"}