From f9f863aa1b6a5a89a343d12aee208868f572b825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Andri=C4=87?= Date: Fri, 5 Mar 2021 12:58:25 -0500 Subject: [PATCH 1/4] adds serve --- package.json | 7 ++- yarn.lock | 119 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 115 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 658b5a4..d1e664e 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,16 @@ "recompose": "^0.26.0", "semantic-ui-css": "2.2.12", "semantic-ui-react": "^0.81.1", + "serve": "^11.3.2", "url-join": "^2.0.2", "vanilla-ripplejs": "^1.0.3" }, + "bin": { + "serve": "./node_modules/.bin/serve" + }, "scripts": { "start": "react-scripts-ts start", + "serve": "npm run build && NODE_ENV=production serve -s build", "build": "react-scripts-ts build", "test": "react-scripts-ts test --env=jsdom", "eject": "react-scripts-ts eject", @@ -69,4 +74,4 @@ "trailingComma": "all", "singleQuote": true } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index d4b8334..501635b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1496,6 +1496,10 @@ version "4.2.2" resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" +"@zeit/schemas@2.6.0": + version "2.6.0" + resolved "https://registry.yarnpkg.com/@zeit/schemas/-/schemas-2.6.0.tgz#004e8e553b4cd53d538bd38eac7bcbf58a867fe3" + abab@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" @@ -1590,6 +1594,15 @@ ajv-keywords@^3.1.0: version "3.4.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.0.tgz#4b831e7b531415a7cc518cd404e73f6193c6349d" +ajv@6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9" + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ajv@^5.0.0, ajv@^5.1.5: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" @@ -1698,6 +1711,10 @@ aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" +arch@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/arch/-/arch-2.2.0.tgz#1bc47818f305764f23ab3306b0bfc086c5a29d11" + are-we-there-yet@~1.1.2: version "1.1.5" resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" @@ -1705,6 +1722,10 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arg/-/arg-2.0.0.tgz#c06e7ff69ab05b3a4a03ebe0407fac4cba657545" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1925,7 +1946,6 @@ aws4@^1.8.0: axios@^0.21.1: version "0.21.1" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" - integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== dependencies: follow-redirects "^1.10.0" @@ -2911,7 +2931,7 @@ bowser@^1.7.3: version "1.9.4" resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.9.4.tgz#890c58a2813a9d3243704334fa81b96a5c150c9a" -boxen@^1.2.1: +boxen@1.3.0, boxen@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" dependencies: @@ -3269,6 +3289,14 @@ chalk@1.1.3, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -3423,6 +3451,13 @@ clipboard@^2.0.0: select "^1.1.2" tiny-emitter "^2.0.0" +clipboardy@1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-1.2.3.tgz#0526361bf78724c1f20be248d428e365433c07ef" + dependencies: + arch "^2.1.0" + execa "^0.8.0" + cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" @@ -3576,7 +3611,7 @@ compressible@~2.0.14: dependencies: mime-db ">= 1.38.0 < 2" -compression@^1.5.2: +compression@1.7.3, compression@^1.5.2: version "1.7.3" resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.3.tgz#27e0e176aaf260f7f2c2813c3e440adb9f1993db" dependencies: @@ -4687,6 +4722,18 @@ execa@^0.7.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + exenv@^1.2.0: version "1.2.2" resolved "https://registry.yarnpkg.com/exenv/-/exenv-1.2.2.tgz#2ae78e85d9894158670b03d47bec1f03bd91bb9d" @@ -4867,6 +4914,12 @@ fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" +fast-url-parser@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" + dependencies: + punycode "^1.3.2" + fastparse@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.2.tgz#91728c5a5942eced8531283c79441ee4122c35a9" @@ -5073,7 +5126,6 @@ follow-redirects@^1.0.0: follow-redirects@^1.10.0: version "1.13.1" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7" - integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg== for-in@^0.1.3: version "0.1.8" @@ -7155,7 +7207,6 @@ lodash.uniq@^4.5.0: lodash@^4.17.19: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" - integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== log-symbols@^2.1.0: version "2.2.0" @@ -7407,6 +7458,16 @@ miller-rabin@^4.0.0: version "1.38.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad" +mime-db@~1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" + +mime-types@2.1.18: + version "2.1.18" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" + dependencies: + mime-db "~1.33.0" + mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.18, mime-types@~2.1.19: version "2.1.22" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.22.tgz#fe6b355a190926ab7698c9a0556a11199b2199bd" @@ -8166,7 +8227,7 @@ path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" -path-is-inside@^1.0.1: +path-is-inside@1.0.2, path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" @@ -8182,6 +8243,10 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" +path-to-regexp@2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.2.1.tgz#90b617025a16381a879bc82a38d4e8bdeb2bcf45" + path-to-regexp@^1.0.1, path-to-regexp@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" @@ -8818,7 +8883,7 @@ punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" -punycode@^1.2.4, punycode@^1.4.1: +punycode@^1.2.4, punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -8892,7 +8957,7 @@ randomfill@^1.0.3: randombytes "^2.0.5" safe-buffer "^5.1.0" -range-parser@^1.0.3, range-parser@~1.2.0: +range-parser@1.2.0, range-parser@^1.0.3, range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" @@ -9474,14 +9539,14 @@ regexpu-core@^4.1.3, regexpu-core@^4.2.0: unicode-match-property-ecmascript "^1.0.4" unicode-match-property-value-ecmascript "^1.1.0" -registry-auth-token@^3.0.1: +registry-auth-token@3.3.2, registry-auth-token@^3.0.1: version "3.3.2" resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.2.tgz#851fd49038eecb586911115af845260eec983f20" dependencies: rc "^1.1.6" safe-buffer "^5.0.1" -registry-url@^3.0.3: +registry-url@3.1.0, registry-url@^3.0.3: version "3.1.0" resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" dependencies: @@ -9860,6 +9925,19 @@ serve-favicon@^2.5.0: parseurl "~1.3.2" safe-buffer "5.1.1" +serve-handler@6.1.3: + version "6.1.3" + resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.1.3.tgz#1bf8c5ae138712af55c758477533b9117f6435e8" + dependencies: + bytes "3.0.0" + content-disposition "0.5.2" + fast-url-parser "1.1.3" + mime-types "2.1.18" + minimatch "3.0.4" + path-is-inside "1.0.2" + path-to-regexp "2.2.1" + range-parser "1.2.0" + serve-index@^1.7.2: version "1.9.1" resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" @@ -9881,6 +9959,20 @@ serve-static@1.13.2: parseurl "~1.3.2" send "0.16.2" +serve@^11.3.2: + version "11.3.2" + resolved "https://registry.yarnpkg.com/serve/-/serve-11.3.2.tgz#b905e980616feecd170e51c8f979a7b2374098f5" + dependencies: + "@zeit/schemas" "2.6.0" + ajv "6.5.3" + arg "2.0.0" + boxen "1.3.0" + chalk "2.4.1" + clipboardy "1.2.3" + compression "1.7.3" + serve-handler "6.1.3" + update-check "1.5.2" + serviceworker-cache-polyfill@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/serviceworker-cache-polyfill/-/serviceworker-cache-polyfill-4.0.0.tgz#de19ee73bef21ab3c0740a37b33db62464babdeb" @@ -10980,6 +11072,13 @@ upath@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" +update-check@1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/update-check/-/update-check-1.5.2.tgz#2fe09f725c543440b3d7dabe8971f2d5caaedc28" + dependencies: + registry-auth-token "3.3.2" + registry-url "3.1.0" + update-notifier@^2.3.0, update-notifier@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.5.0.tgz#d0744593e13f161e406acb1d9408b72cad08aff6" From b2f1bb839502e8c2b23074dd3116e42af8230b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Andri=C4=87?= Date: Fri, 5 Mar 2021 15:15:50 -0500 Subject: [PATCH 2/4] removed nginx from docker deploy --- Dockerfile | 30 +++++++----------------------- nginx/default.conf.template | 22 ---------------------- nginx/nginx.conf | 32 -------------------------------- 3 files changed, 7 insertions(+), 77 deletions(-) delete mode 100644 nginx/default.conf.template delete mode 100644 nginx/nginx.conf diff --git a/Dockerfile b/Dockerfile index b563c20..65f29bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,10 @@ -####################### -# Builder -####################### -FROM node:11.15.0 as builder +FROM node:14.16.0-alpine WORKDIR /usr/src/app COPY . . -ENV REACT_APP_API=REACT_APP_API_PLACEHOLDER -ENV REACT_APP_EGO_CLIENT_ID=REACT_APP_EGO_CLIENT_ID_PLACEHOLDER - -RUN yarn install && yarn build - -####################### -# Server -####################### -FROM nginx:1.17.8-alpine - -COPY --from=builder /usr/src/app/build /usr/share/nginx/html -COPY nginx/default.conf.template /etc/nginx/conf.d/default.conf.template -COPY nginx/nginx.conf /etc/nginx/nginx.conf +RUN yarn install ENV EGO_UI_USER=egoui ENV EGO_UI_UID=9999 @@ -30,14 +15,13 @@ ENV PORT=8080 RUN addgroup -S -g $EGO_UI_GID $EGO_UI_USER \ && adduser -S -u $EGO_UI_UID -G $EGO_UI_USER $EGO_UI_USER \ - && chown -R $EGO_UI_UID:$EGO_UI_GID /etc/nginx/conf.d \ - && chown -R $EGO_UI_UID:$EGO_UI_GID /var/cache \ - && chown -R $EGO_UI_UID:$EGO_UI_GID /var/log/nginx \ - && chown -R $EGO_UI_UID:$EGO_UI_GID /run + && chown -R $EGO_UI_UID:$EGO_UI_GID /usr/src/app -# default client_id is set to ego +# defaults ENV REACT_APP_EGO_CLIENT_ID=ego +ENV REACT_APP_API=http://localhost:8081/ +ENV PUBLIC_URL="/" USER $EGO_UI_UID -CMD uri=\$uri envsubst < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;' +CMD ["yarn", "run", "serve", "-l", "8080"] diff --git a/nginx/default.conf.template b/nginx/default.conf.template deleted file mode 100644 index 50fb370..0000000 --- a/nginx/default.conf.template +++ /dev/null @@ -1,22 +0,0 @@ -server { - listen $PORT; - server_name localhost; - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - - try_files $uri $uri/ /index.html; - - sub_filter "REACT_APP_API_PLACEHOLDER" $REACT_APP_API; - sub_filter "REACT_APP_EGO_CLIENT_ID_PLACEHOLDER" $REACT_APP_EGO_CLIENT_ID; - sub_filter_once off; # Don't stop at the first match, replace all of them - sub_filter_types "application/javascript"; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } - -} diff --git a/nginx/nginx.conf b/nginx/nginx.conf deleted file mode 100644 index f2ed634..0000000 --- a/nginx/nginx.conf +++ /dev/null @@ -1,32 +0,0 @@ - -#user nginx; -worker_processes auto; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - - -events { - worker_connections 1024; -} - - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; -} From 91145b60d9f1c3ff32bd815be2f7f8de491e7574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Andri=C4=87?= Date: Fri, 5 Mar 2021 16:21:42 -0500 Subject: [PATCH 3/4] NEWLINE --- .vscode/settings.json | 3 ++- package.json | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 95c6938..3f80cd0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { "editor.formatOnSave": true, - "editor.tabSize": 2 + "editor.tabSize": 2, + "files.insertFinalNewline": true } diff --git a/package.json b/package.json index d1e664e..3e773cd 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,6 @@ "prettier": { "printWidth": 100, "trailingComma": "all", - "singleQuote": true + "singleQuote": true, } -} \ No newline at end of file +} From f50e4ad11a471f4cc582f8f76c48a693de61addc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Andri=C4=87?= Date: Mon, 8 Mar 2021 10:28:30 -0500 Subject: [PATCH 4/4] trailing comma in pkg json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e773cd..9cb5b2c 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,6 @@ "prettier": { "printWidth": 100, "trailingComma": "all", - "singleQuote": true, + "singleQuote": true } }