-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: credential ui docker env variables defined in run time (#579)
* fix: docker env variables defined in run time * refactor: simplyfied way to handle env variables on runtime * fix: removed unnecesary copy instruction from Dockerfile
- Loading branch information
1 parent
daf3fa0
commit 954382c
Showing
10 changed files
with
82 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,4 @@ | |
dist | ||
build | ||
node_modules | ||
npm-debug.log | ||
|
||
.env | ||
npm-debug.log |
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,2 @@ | ||
REACT_APP_CREDENTIAL_ISSUANCE_SERVER_URL=http://localhost | ||
REACT_APP_CREDENTIAL_ISSUANCE_SERVER_PORT=3001 |
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 |
---|---|---|
@@ -1,19 +1,29 @@ | ||
FROM node:lts-alpine as build | ||
|
||
WORKDIR /app | ||
COPY package*.json ./ | ||
RUN npm ci | ||
COPY . . | ||
|
||
ARG REACT_APP_CREDENTIAL_ISSUANCE_SERVER_URL | ||
ENV REACT_APP_CREDENTIAL_ISSUANCE_SERVER_URL $REACT_APP_CREDENTIAL_ISSUANCE_SERVER_URL | ||
|
||
ARG REACT_APP_CREDENTIAL_ISSUANCE_SERVER_PORT | ||
ENV REACT_APP_CREDENTIAL_ISSUANCE_SERVER_PORT $REACT_APP_CREDENTIAL_ISSUANCE_SERVER_PORT | ||
|
||
RUN npm run build | ||
|
||
|
||
FROM nginx:alpine | ||
|
||
# Nginx config | ||
RUN rm -rf /etc/nginx/conf.d | ||
COPY conf /etc/nginx | ||
|
||
COPY --from=build /app/build /usr/share/nginx/html | ||
|
||
# Copy .env file and shell script to container | ||
WORKDIR /usr/share/nginx/html | ||
COPY ./env.sh . | ||
|
||
# Make our shell script executable | ||
RUN chmod +x env.sh | ||
|
||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] | ||
|
||
# Start Nginx server | ||
CMD ["/bin/sh", "-c", "/usr/share/nginx/html/env.sh && 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,13 @@ | ||
server { | ||
listen 80; | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
expires -1; # Set it to different value depending on your standard requirements | ||
} | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
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,24 @@ | ||
gzip on; | ||
gzip_http_version 1.0; | ||
gzip_comp_level 5; # 1-9 | ||
gzip_min_length 256; | ||
gzip_proxied any; | ||
gzip_vary on; | ||
|
||
# MIME-types | ||
gzip_types | ||
application/atom+xml | ||
application/javascript | ||
application/json | ||
application/rss+xml | ||
application/vnd.ms-fontobject | ||
application/x-font-ttf | ||
application/x-web-app-manifest+json | ||
application/xhtml+xml | ||
application/xml | ||
font/opentype | ||
image/svg+xml | ||
image/x-icon | ||
text/css | ||
text/plain | ||
text/x-component; |
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 @@ | ||
#!/bin/sh | ||
echo "window._env_ = {" > ./env-config.js | ||
for var in $(env | grep ^REACT_APP_); do | ||
echo " \"${var%%=*}\": \"${var#*=}\"," >> ./env-config.js | ||
done | ||
echo "};" >> ./env-config.js |
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