-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nginx4spa): add spa nginx image (#33)
- Loading branch information
1 parent
f642a9c
commit 1bfd078
Showing
12 changed files
with
83 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Build socialgouv/docker/nginx4spa: | ||
stage: "Build" | ||
extends: .base_register_to_gitlab_stage | ||
variables: | ||
CONTEXT: nginx4spa | ||
IMAGE_NAME: ${CI_REGISTRY_IMAGE}/nginx4spa | ||
|
||
Test socialgouv/docker/nginx4spa: | ||
stage: "Test" | ||
image: "${CI_REGISTRY_IMAGE}/nginx4spa:${CI_COMMIT_SHA}" | ||
cache: | ||
key: ${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG} | ||
paths: | ||
- ${CI_PROJECT_DIR}/var/cache/apk | ||
variables: | ||
NGINX_PORT: 8888 | ||
VERSION: x.y.z | ||
WWW_DIRECTORY: ${CI_PROJECT_DIR}/nginx4spa/test | ||
script: | ||
- sed -i -e "s|/usr/share/nginx/html|${WWW_DIRECTORY}|g" /etc/nginx/nginx.conf | ||
- sed -i -e "s|80|${NGINX_PORT}|g" /etc/nginx/nginx.conf | ||
- /entrypoint.sh & | ||
- nginx -s stop || pkill nginx || true | ||
# | ||
- nginx | ||
# | ||
- apk --update add curl | ||
- curl -s localhost:${NGINX_PORT} | ||
- curl -s localhost:${NGINX_PORT} | | ||
grep "nginx4spa/test/index.html with VERSION=x.y.z" | ||
- curl -s localhost:${NGINX_PORT}/foo/bar/bar.js | ||
- curl -s localhost:${NGINX_PORT}/foo/bar/bar.js | | ||
grep "// nginx4spa/test/foo/bar/bar.js with VERSION=x.y.z" | ||
# | ||
- kill $(ps aux | grep '[n]ginx' | awk '{print $1}') | ||
|
||
Publish socialgouv/docker/nginx4spa to Github Registry: | ||
extends: .base_publish_to_github_stage | ||
variables: | ||
IMAGE_NAME: socialgouv/docker/nginx4spa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
FROM nginx:1.17 | ||
FROM nginx:1.17-alpine | ||
|
||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
COPY ./entrypoint.sh /entrypoint.sh | ||
COPY ./envsub.sh /envsub.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# KubeCtrl | ||
|
||
> KubeCtrl image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
|
||
source /envsub.sh | ||
|
||
exec nginx -g 'daemon off;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env sh | ||
|
||
################################################################################ | ||
# Replace environment values in files # | ||
################################################################################ | ||
|
||
# | ||
# As defualt, in every files in the "/usr/share/nginx/html" directory, this | ||
# script replace `%%KEY%%` by `VALUE` where `export KEY=VALUE` in the global env var. | ||
# | ||
|
||
WWW_DIRECTORY=${WWW_DIRECTORY:="/usr/share/nginx/html"} | ||
DELIMITER=${DELIMITER:="%%"} | ||
|
||
# Save env variable in file | ||
printenv > /tmp/env-vars | ||
|
||
while IFS='=' read -r KEY VALUE | ||
do | ||
# In every files in the dir, replace the environment variables value | ||
find ${WWW_DIRECTORY} -type f -exec \ | ||
sed -i -e "s|${DELIMITER}${KEY}${DELIMITER}|${VALUE}|g" {} \; | ||
done < /tmp/env-vars | ||
|
||
rm /tmp/env-vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// nginx4spa/test/foo/bar/bar.js with VERSION=%%VERSION%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nginx4spa/test/index.html with VERSION=%%VERSION%% |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.