Skip to content

Commit

Permalink
chore: Remove envsubst
Browse files Browse the repository at this point in the history
  • Loading branch information
achauve committed Mar 25, 2022
1 parent b4aa630 commit b9ddd40
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 154 deletions.
1 change: 0 additions & 1 deletion nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM nginxinc/nginx-unprivileged:1.21-alpine

COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./entrypoint.sh /entrypoint.sh
COPY ./envsub.sh /envsub.sh
COPY ./404.html /usr/share/nginx/errors/

## adjust permissions
Expand Down
22 changes: 0 additions & 22 deletions nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
> Nginx image for static web apps
- Serve static files from `/usr/share/nginx/html`
- envsubst `%%VARIABLE%%` static files at startup (ex: builds)
- Add some security-related headers :

```
Expand All @@ -14,27 +13,6 @@ add_header X-Content-Type-Options "nosniff";

> For a single-page-applications nginx image, see [../nginx4spa](../nginx4spa)
## Envsubst on startup

As default, in every files in the `/usr/share/nginx/html` directory, the [`envsub.sh`](./envsub.sh) script replaces `%%KEY%%` by `VALUE` where `export KEY=VALUE` in the global env var.

You can disable this by setting the `SKIP_ENVSUBST` environment variable.

So :

```sh
$ echo "VERSION=%%VERSION%%" > /www/version.txt
$ docker run \
--env VERSION=x.y.z \
--env PORT=4444 \
--name nginx_test \
--publish 8888:4444 \
--rm \
--volume /www:/usr/share/nginx/html \
ghcr.io/socialgouv/docker/nginx
$ curl localhost:8888/version.txt
VERSION=x.y.z
```

Notes:

Expand Down
2 changes: 0 additions & 2 deletions nginx/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env sh

source /envsub.sh

exec nginx -g 'daemon off;'
31 changes: 0 additions & 31 deletions nginx/envsub.sh

This file was deleted.

2 changes: 1 addition & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ http {
sendfile on;

server {
listen %%PORT%%;
listen 8080;
root /usr/share/nginx/html;
index index.html;
server_name_in_redirect on;
Expand Down
37 changes: 0 additions & 37 deletions nginx/tests/envsub.bats

This file was deleted.

1 change: 0 additions & 1 deletion nginx/tests/fixtures-envsubst/404.html

This file was deleted.

1 change: 0 additions & 1 deletion nginx/tests/fixtures-envsubst/foo/bar/bar.js

This file was deleted.

1 change: 0 additions & 1 deletion nginx/tests/fixtures-envsubst/foo/bar/bar.png

This file was deleted.

1 change: 0 additions & 1 deletion nginx/tests/fixtures-envsubst/index.html

This file was deleted.

22 changes: 0 additions & 22 deletions nginx/tests/port.bats

This file was deleted.

34 changes: 0 additions & 34 deletions nginx/tests/skip-envsub.bats

This file was deleted.

0 comments on commit b9ddd40

Please sign in to comment.