{"id":24591955,"url":"https://github.com/blazium-engine/docker-webbuild-template","last_synced_at":"2025-03-18T02:44:23.075Z","repository":{"id":273183826,"uuid":"918927263","full_name":"blazium-engine/docker-webbuild-template","owner":"blazium-engine","description":"Blazium Engine Template for Deploying Web Builds, with additional Support for Discord Embedded App Handling","archived":false,"fork":false,"pushed_at":"2025-02-22T19:27:53.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T20:25:54.324Z","etag":null,"topics":["blazium","discord","discord-embedded-app-sdk","gamedev","godot","wasm","webbuild"],"latest_commit_sha":null,"homepage":"https://blazium.app","language":"Shell","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/blazium-engine.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,"publiccode":null,"codemeta":null}},"created_at":"2025-01-19T08:44:21.000Z","updated_at":"2025-02-22T19:27:57.000Z","dependencies_parsed_at":"2025-01-19T09:30:17.923Z","dependency_job_id":"178fc222-c341-48cd-8bb3-d7966e153559","html_url":"https://github.com/blazium-engine/docker-webbuild-template","commit_stats":null,"previous_names":["blazium-engine/docker-webbuild-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blazium-engine%2Fdocker-webbuild-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blazium-engine%2Fdocker-webbuild-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blazium-engine%2Fdocker-webbuild-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blazium-engine%2Fdocker-webbuild-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blazium-engine","download_url":"https://codeload.github.com/blazium-engine/docker-webbuild-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244147184,"owners_count":20405940,"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":["blazium","discord","discord-embedded-app-sdk","gamedev","godot","wasm","webbuild"],"created_at":"2025-01-24T10:13:14.930Z","updated_at":"2025-03-18T02:44:23.068Z","avatar_url":"https://github.com/blazium-engine.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker WebBuild Template\n\nThis repository provides a template for deploying web-exported game builds of the Blazium Game Engine as Discord Embedded Applications. It includes all the necessary configurations and scripts to meet Discord's embedding restrictions, such as the requirement for `.proxy` in URIs for loading assets. The setup simplifies deployment to Docker and ensures compatibility with Discord's embedded environment.\n\n---\n\n## Features\n\n- **Dockerized Deployment**: Build, tag, and push Docker images using a `Makefile` with a single command.\n- **Discord Embedding Support**: Includes Nginx configurations to handle `.proxy` URIs for Discord compatibility.\n- **Environment Variable Integration**: Easy customization through a `.env` file for project-specific settings.\n- **Pre-configured Directory Structure**:\n  - `Dockerfile`: Defines the Docker image for the project.\n  - `scripts/`: Contains reusable Bash scripts for deployment and management.\n  - `nginx/`: Holds the Nginx configuration file (`nginx.conf`).\n  - `static/`: Drop your Blazium web-exported game builds here for inclusion in the Docker image.\n  - `Makefile`: Automates deployment tasks.\n\n---\n\n## Addition: 2/22/2025\n\n### Support for YouTube Playables\n\nYouTube Playables requires that the initial game bundle be **less than 15 MiB**.\nTo meet this requirement, **WebAssembly (WASM) files must be precompressed**.\nThis configuration will serve the pre-compressed wasm files if present and\nsupported by the browser, otherwise it will fallback to the uncompressed\nversion.\n\n### How It Works\n- If the browser **supports gzip encoding**, Nginx serves the precompressed `.wasm.gz` file **as if it were** a `.wasm` file.\n- If the browser **does not support gzip**, Nginx falls back to serving the original `.wasm` file.\n- This behavior helps ensure compatibility while keeping the initial bundle size under the **15 MiB limit** required by YouTube Playables.\n\n### Implementation Details\n- `gzip_static` enables serving a precompressed `.gz` file if it exists and the client supports gzip.\n- If the client does not support gzip or no precompressed file exists, Nginx will serve the uncompressed file.\n- This is done with the appropiate `Content-Type` and `Content-Encoding` headers.\n\nThis ensures that **web-exported games** can be deployed on **YouTube Playables** while remaining within the required file size constraints.\n\nAlso `/ytgame` endpoint is added to not serve with the `Cross-Origin-Opener-Policy \"same-origin\"` and `Cross-Origin-Embedder-Policy \"require-corp\"`.\n\n---\n\n## Directory Structure\n\n```plaintext\n.\n├── Dockerfile              # Defines the Docker image\n├── scripts/                # Contains Bash scripts\n│   ├── deploy.sh           # Deploys the Docker image\n│   └── credits.sh          # Exports author and project metadata\n├── nginx/                  # Contains Nginx configuration files\n│   └── nginx.conf          # Nginx configuration for Discord Embedded Applications\n├── static/                 # Drop your exported Blazium web builds here\n│   └── .keep               # Placeholder file to keep the directory in Git\n├── Makefile                # Automates Docker build and deployment\n├── .env                    # Environment variables file\n└── README.md               # Project documentation\n```\n\n---\n\n## Requirements\n\n- Docker installed on your system.\n- A `.env` file with the following variables:\n\n```plaintext\nPROJECT_NAME=hangman                   # The name of your project\nDOCKER_REGISTRY=registry.digitalocean.com  # Docker registry URL\nREGISTRY_PATH=blazium                  # Registry path for the project\nTAG=latest                             # Image tag (default: latest)\n```\n\n---\n\n## Getting Started\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/blazium-engine/docker-webbuild-template.git\ncd docker-webbuild-template\n```\n\n### 2. Create the `.env` File\nCreate a `.env` file in the root directory and set the environment variables:\n```plaintext\nPROJECT_NAME=hangman\nDOCKER_REGISTRY=registry.digitalocean.com\nREGISTRY_PATH=blazium\nTAG=latest\n```\n\n### 3. Drop Your Web Build into the `static/` Folder\nExport your Blazium game build to a local directory, then copy all the exported files into the `static/` folder in this repository:\n```bash\ncp -r /path/to/your/blazium-build/* static/\n```\n\n- **Important**: The `.keep` file in the `static/` folder is there to ensure the folder is tracked in Git. It will **not** be included in the Docker build.\n\nDuring the build process, all files in the `static/` folder will be copied into the Docker image under `/usr/share/nginx/html`.\n\n### 4. Deploy the Project\nRun the following command to build, tag, and push the Docker image:\n```bash\nmake deploy-docker\n```\n\nThis command uses the `deploy.sh` script located in the `scripts/` folder, which reads the `.env` file and handles the deployment process.\n\n---\n\n## Nginx Configuration\n\nThe `nginx/nginx.conf` file is pre-configured to support `.proxy` URIs required by Discord Embedded Applications. Key features of the configuration:\n- Serves assets from the `/usr/share/nginx/html` directory.\n- Ensures compatibility with Discord's restrictions through the `.proxy` location block.\n- Includes CORS headers:\n  ```nginx\n  add_header Cross-Origin-Opener-Policy \"same-origin\" always;\n  add_header Cross-Origin-Embedder-Policy \"require-corp\" always;\n  ```\n\n---\n\n## Author\n\n- **Name**: Randolph William Aarseth II  \n- **Email**: randolph@divine.games  \n- **Organization**: Divine Games  \n\n---\n\n## Contributing\n\nFeel free to fork the repository and submit pull requests to improve the template. Contributions are welcome!\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n\n---\n\n## Acknowledgments\n\nThis template is designed for deploying Blazium Game Engine web builds and ensuring compliance with Discord's embedding requirements. Special thanks to the Divine Games team for their efforts in game development and deployment optimization.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblazium-engine%2Fdocker-webbuild-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblazium-engine%2Fdocker-webbuild-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblazium-engine%2Fdocker-webbuild-template/lists"}