Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chneau/docker-nginx-spa
Docker image used to serve a Single Page App with environment substitution
https://github.com/chneau/docker-nginx-spa
docker environment nginx runtime spa substitution
Last synced: about 5 hours ago
JSON representation
Docker image used to serve a Single Page App with environment substitution
- Host: GitHub
- URL: https://github.com/chneau/docker-nginx-spa
- Owner: chneau
- Created: 2024-02-06T18:23:37.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-04-05T09:06:56.000Z (7 months ago)
- Last Synced: 2024-04-16T00:20:54.344Z (7 months ago)
- Topics: docker, environment, nginx, runtime, spa, substitution
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-nginx-spa
Docker image used to serve a Single Page App with environment substitution.
This image is built every day at 00:00 UTC.## Test it!
```bash
docker run --rm -it -e _nginx=HACKED -p 7777:8080 ghcr.io/chneau/nginx-spa
# open your browser at http://localhost:7777 to see all the nginx replaced with HACKED
```## Typical usage
```Dockerfile
FROM oven/bun:1 as build
ENV VITE_CLIENT_ID="_VITE_CLIENT_ID"
ENV VITE_CLIENT_SECRET="_VITE_CLIENT_SECRET"
ENV VITE_REDIRECT_URI="_VITE_REDIRECT_URI"
WORKDIR /app
COPY package.json bun.lockb .
RUN bun install --frozen-lockfile
COPY . .
RUN bun x vite buildFROM ghcr.io/chneau/nginx-spa
COPY --from=build /app/dist /usr/share/nginx/html
``````bash
# build it
docker build -t test .# run it with with your own env var
docker run --rm -it test -e __VITE_CLIENT_ID=123 -e __VITE_CLIENT_SECRET=456 -e __VITE_REDIRECT_URI=http://localhost:3000 -p 7777:8080 test# By default the prefix is _, you can change it with the PREFIX env var
# Just add a _ to the value you want to replace in your SPA files
```