{"id":20215922,"url":"https://github.com/pkarpovich/env-driven-static-server","last_synced_at":"2026-04-09T08:20:35.362Z","repository":{"id":229696355,"uuid":"777399931","full_name":"pkarpovich/env-driven-static-server","owner":"pkarpovich","description":"Create and assign dynamic environment variables to your SPA at runtime through environment variables. This is ideal for reusing containers across various environments","archived":false,"fork":false,"pushed_at":"2024-04-10T20:46:09.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T22:16:48.891Z","etag":null,"topics":["docker","environment-variables","react","spa","vue"],"latest_commit_sha":null,"homepage":"","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/pkarpovich.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":"2024-03-25T19:28:34.000Z","updated_at":"2024-04-04T20:46:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f8c6482-1347-44c1-b711-329678fb77d9","html_url":"https://github.com/pkarpovich/env-driven-static-server","commit_stats":null,"previous_names":["pkarpovich/env-driven-static-server"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkarpovich%2Fenv-driven-static-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkarpovich%2Fenv-driven-static-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkarpovich%2Fenv-driven-static-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkarpovich%2Fenv-driven-static-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkarpovich","download_url":"https://codeload.github.com/pkarpovich/env-driven-static-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241652964,"owners_count":19997578,"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","environment-variables","react","spa","vue"],"created_at":"2024-11-14T06:25:28.447Z","updated_at":"2025-11-28T08:06:34.472Z","avatar_url":"https://github.com/pkarpovich.png","language":"Shell","readme":"\n# env-driven-static-server\n\n## Introduction\n\n`env-driven-static-server` is a flexible solution that enhances the deployment process of frontend applications by dynamically assigning environment-specific variables. With this, you can create a single, reusable container build for different environments, each with their own configurations. Instead of hard-coding variables into your build, this tool allows them to be assigned at the container start, making your deployment process much more flexible\n\n## Usage\n\nTo use `env-driven-static-server`, start the container with the necessary environment variables prefixed with `VITE_`. For example:\n\n```sh\ndocker run -e VITE_API_BASE_URL=http://api.example.com env-driven-static-server\n```\n\nAn example `Dockerfile` for deploying a React application using `env-driven-static-server`:\n\n```Dockerfile\nFROM ghcr.io/pkarpovich/env-driven-static-server:latest\nCOPY --from=builder /app/dist/ /public\n```\n\nThis Dockerfile uses the `env-driven-static-server` as a base image and copies the build artifacts from the `builder` stage into the `/public` directory of the container.\n\n\nThis will inject the environment variables into the frontend application, making them accessible as follows:\n\n```javascript\nexport const Config = {\n  API_BASE_URL: import.meta.env.VITE_API_BASE_URL || window._env_.VITE_API_BASE_URL,\n};\n```\n\n## Features\n\n- **Dynamic Environment Variables**: Injects environment variables directly into the frontend application at runtime.\n- **Single Build for Multiple Environments**: Eliminates the need for multiple builds for different environments, streamlining the deployment process.\n- **Easy Configuration**: Simple and intuitive setup process, requiring minimal changes to existing projects.\n\n## License\n\nProject is released under the MIT License. See the [LICENSE](LICENSE) file for more details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkarpovich%2Fenv-driven-static-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkarpovich%2Fenv-driven-static-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkarpovich%2Fenv-driven-static-server/lists"}