-
Notifications
You must be signed in to change notification settings - Fork 1
TT-511 containerize time tracker UI #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3fe4574
feat: TT-511 containerize time tracker ui
mikevillarruel ff75680
feat: TT-511 environment variables and tests setup
mikevillarruel 128d71d
fix: TT-511 add missing environment variables
mikevillarruel 3e5a455
fix: TT-511 update .dockerignore
mikevillarruel 55d06c2
refactor: TT-511 solve comments
mikevillarruel b0dfd5a
feat: TT-511 multi-stage builds in dockerfile and add user to run com…
mikevillarruel 40a7d83
feat: TT-511 create build and docker image for production
mikevillarruel 73514ac
refactor: TT-511 solve comments
mikevillarruel 7f0690f
fix: TT-511 changes in makefile to solve comments
mikevillarruel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: TT-511 create build and docker image for production
- Loading branch information
commit 40a7d83c8172f9a9fa4992f560249359c588ac0d
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,6 +4,5 @@ dist | |
| coverage | ||
| Makefile | ||
| .gitignore | ||
| .env | ||
| src/environments/keys.ts | ||
| src/environments/.keys.json | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -6,8 +6,8 @@ ENV HOME /home/${USERNAME} | |
| RUN useradd -ms /bin/bash ${USERNAME} | ||
|
|
||
| WORKDIR ${HOME}/time-tracker-ui | ||
| COPY [^.env]* . . | ||
| RUN chown ${USERNAME}:${USERNAME} -R ${HOME} | ||
| COPY --chown=${USERNAME}:${USERNAME} . . | ||
|
|
||
| USER ${USERNAME} | ||
| RUN npm cache clean --force && npm install | ||
|
|
@@ -17,18 +17,29 @@ CMD npm run config && ${HOME}/time-tracker-ui/node_modules/.bin/ng serve --host | |
|
|
||
|
|
||
|
|
||
| FROM node:14 AS production | ||
| FROM node:14 AS build | ||
|
|
||
| ENV USERNAME timetracker | ||
| ENV HOME /home/${USERNAME} | ||
| WORKDIR /usr/local/app | ||
| COPY ./ /usr/local/app/ | ||
|
|
||
| RUN useradd -m -d ${HOME} -s /bin/bash ${USERNAME} | ||
| RUN npm install | ||
| RUN npm run build | ||
|
|
||
| WORKDIR ${HOME}/time-tracker-ui | ||
| RUN chown ${USERNAME}:${USERNAME} -R ${HOME} | ||
| COPY --chown=${USERNAME}:${USERNAME} . . | ||
|
|
||
|
|
||
| FROM nginx:1.21 AS production | ||
|
|
||
| ENV USERNAME nginx | ||
faustocv marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| COPY nginx.conf /etc/nginx/conf.d/ | ||
|
||
| COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
| COPY --from=build /usr/local/app/dist/time-tracker /usr/share/nginx/html | ||
|
|
||
| RUN chown -R ${USERNAME}:${USERNAME} /var/cache/nginx && \ | ||
| chown -R ${USERNAME}:${USERNAME} /var/log/nginx && \ | ||
| chown -R ${USERNAME}:${USERNAME} /etc/nginx/conf.d | ||
| RUN touch /var/run/nginx.pid && chown -R ${USERNAME}:${USERNAME} /var/run/nginx.pid | ||
|
|
||
| USER ${USERNAME} | ||
| RUN npm cache clean --force && npm install | ||
| EXPOSE 4200 | ||
| CMD npm run config && /time-tracker-ui/node_modules/.bin/ng serve --host 0.0.0.0 --disableHostCheck --prod | ||
|
|
||
| EXPOSE 4200 | ||
This file contains hidden or 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 hidden or 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,12 @@ | ||
| server { | ||
| listen 4200; | ||
|
|
||
| root /usr/share/nginx/html; | ||
| index index.html; | ||
|
|
||
| server_name _; | ||
|
|
||
| location / { | ||
| try_files $uri /index.html; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.