-
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(spa-nginx): add spa nginx image (#31)
- Loading branch information
1 parent
a1e082b
commit f642a9c
Showing
6 changed files
with
100 additions
and
0 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,18 @@ | ||
Build socialgouv/docker/spa-nginx: | ||
stage: "Build" | ||
extends: .base_register_to_gitlab_stage | ||
variables: | ||
CONTEXT: spa-nginx | ||
IMAGE_NAME: ${CI_REGISTRY_IMAGE}/spa-nginx | ||
|
||
Test socialgouv/docker/spa-nginx: | ||
stage: "Test" | ||
image: "${CI_REGISTRY_IMAGE}/spa-nginx:${CI_COMMIT_SHA}" | ||
environment: feature-dev | ||
script: | ||
- echo "todo..." | ||
|
||
Publish socialgouv/docker/spa-nginx to Github Registry: | ||
extends: .base_publish_to_github_stage | ||
variables: | ||
IMAGE_NAME: socialgouv/docker/spa-nginx |
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,6 @@ | ||
FROM nginx:1.17 | ||
|
||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
COPY ./entrypoint.sh /entrypoint.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,25 @@ | ||
#!/usr/bin/env sh | ||
|
||
ROOT_DIRECTORY="/usr/share/nginx/html" | ||
|
||
############################################################## | ||
# Step 1 : replace default environment values in .html files # | ||
############################################################## | ||
|
||
# Save env variable in file | ||
printenv >> env-vars | ||
|
||
while IFS='=' read -r KEY VALUE | ||
do | ||
# replace default environment variables value | ||
find $ROOT_DIRECTORY -type f -name \*.js -exec \ | ||
sed -i -e "s|%%$KEY%%|$VALUE|g" {} + | ||
done <env-vars | ||
|
||
rm env-vars | ||
|
||
######################### | ||
# Step 2 : Start NGINX # | ||
######################### | ||
|
||
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,48 @@ | ||
user nginx; | ||
worker_processes auto; # it will be determinate automatically by the number of core | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log; | ||
keepalive_timeout 3000; | ||
absolute_redirect off; | ||
|
||
server { | ||
listen 80; | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
server_name_in_redirect on; | ||
|
||
gzip on; | ||
gzip_disable "msie6"; | ||
gzip_vary on; | ||
gzip_proxied any; | ||
gzip_comp_level 6; | ||
gzip_buffers 16 8k; | ||
gzip_http_version 1.1; | ||
gzip_min_length 256; | ||
gzip_types text/css application/json application/javascript application/x-javascript text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon; | ||
|
||
client_max_body_size 32m; | ||
error_page 500 502 503 504 /50x.html; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
location /50x.html { | ||
root /var/lib/nginx/html; | ||
} | ||
|
||
} | ||
} |