-
Notifications
You must be signed in to change notification settings - Fork 3
Dockerfile for Vue.js Application. #20
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
Open
gtarique
wants to merge
5
commits into
m9sweeper:main
Choose a base branch
from
gtarique:dockerfile-vuejs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3eb69be
Debian based dockerfile for vue.js application.
gtarique 04c00a4
Merge remote-tracking branch 'mainrepo/main' into dockerfile-vuejs
gtarique b8d1b4c
Add non root user with UID
gtarique 40b428e
UID added
gtarique 9cdbc17
Change debian image version latest to 12.4
gtarique 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
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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # OS-specific files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Files and directories related to version control systems | ||
| .git | ||
| .gitignore | ||
| .gitmodules | ||
| .svn | ||
| .hg | ||
|
|
||
| # Node.js package management | ||
| node_modules | ||
| npm-debug.log | ||
| yarn-error.log | ||
| yarn.lock | ||
|
|
||
| # Logs and databases | ||
| *.log | ||
| *.sql | ||
| *.sqlite | ||
|
|
||
| # Editor directories and files | ||
| .vscode | ||
| *.swp | ||
| *.swo | ||
| *.sublime* | ||
| .idea/ | ||
| *.iml | ||
| *.bsp |
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,48 @@ | ||
| FROM debian:12.4 | ||
|
|
||
| # Install Node.js, Yarn, Nginx, and Supervisor | ||
| RUN apt-get update && \ | ||
| apt-get install -y curl gnupg nginx supervisor && \ | ||
| curl -sL https://deb.nodesource.com/setup_current.x | bash - && \ | ||
| apt-get install -y nodejs && \ | ||
| npm install --global yarn && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Create a non-root user with a specific UID | ||
| RUN groupadd -g 1000 appgroup && \ | ||
| useradd -m -u 1000 -g appgroup -s /bin/bash appuser | ||
|
|
||
| # Copy the Vue.js application | ||
| COPY ../code /app | ||
|
|
||
| # Set the work directory | ||
| WORKDIR /app | ||
|
|
||
| # Change ownership of the /app directory to the new user | ||
| RUN chown -R appuser:appgroup /app | ||
|
|
||
| # Create necessary directories if not exist and set permission for nginx server | ||
| RUN mkdir -p /var/lib/nginx /usr/share/nginx && chown -R appuser:appgroup /var/lib/nginx /usr/share/nginx /run/ | ||
|
|
||
| # Sed command to outpu logs to stdout and stderr | ||
| RUN sed -i 's|error_log /var/log/nginx/error.log;|error_log stderr;|' /etc/nginx/nginx.conf | ||
| RUN sed -i 's|access_log /var/log/nginx/access.log;|access_log stdout;|' /etc/nginx/nginx.conf | ||
|
|
||
| # Build the Vue.js application | ||
| RUN yarn install && yarn build | ||
|
|
||
| # Configure Nginx | ||
| RUN rm /etc/nginx/sites-enabled/default | ||
| COPY ../Debian/nginx.conf /etc/nginx/sites-enabled/default | ||
|
|
||
| # Supervisor configuration | ||
| COPY ../Debian/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
|
||
| # Switch to the non-root user | ||
| USER 1000 | ||
|
|
||
| # Expose port 8080 | ||
| EXPOSE 8080 | ||
|
|
||
| # Run Supervisor | ||
| CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] | ||
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 8080; | ||
| root /app/dist; | ||
|
|
||
| # Logs to stdout and stderr | ||
| access_log /dev/stdout; | ||
| error_log /dev/stderr; | ||
|
|
||
| location / { | ||
| try_files $uri $uri/ /index.html; | ||
| } | ||
| } |
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,10 @@ | ||
| [supervisord] | ||
| nodaemon=true | ||
|
|
||
| [program:nginx] | ||
| command=/usr/sbin/nginx -g "daemon off;" | ||
| autorestart=true | ||
| stdout_logfile=/dev/stdout | ||
| stdout_logfile_maxbytes=0 | ||
| stderr_logfile=/dev/stderr | ||
| stderr_logfile_maxbytes=0 |
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,23 @@ | ||
| .DS_Store | ||
| node_modules | ||
| /dist | ||
|
|
||
|
|
||
| # local env files | ||
| .env.local | ||
| .env.*.local | ||
|
|
||
| # Log files | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
|
|
||
| # Editor directories and files | ||
| .idea | ||
| .vscode | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? |
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,24 @@ | ||
| # code | ||
|
|
||
| ## Project setup | ||
| ``` | ||
| yarn install | ||
| ``` | ||
|
|
||
| ### Compiles and hot-reloads for development | ||
| ``` | ||
| yarn serve | ||
| ``` | ||
|
|
||
| ### Compiles and minifies for production | ||
| ``` | ||
| yarn build | ||
| ``` | ||
|
|
||
| ### Lints and fixes files | ||
| ``` | ||
| yarn lint | ||
| ``` | ||
|
|
||
| ### Customize configuration | ||
| See [Configuration Reference](https://cli.vuejs.org/config/). |
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,5 @@ | ||
| module.exports = { | ||
| presets: [ | ||
| '@vue/cli-plugin-babel/preset' | ||
| ] | ||
| } |
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,19 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "es5", | ||
| "module": "esnext", | ||
| "baseUrl": "./", | ||
| "moduleResolution": "node", | ||
| "paths": { | ||
| "@/*": [ | ||
| "src/*" | ||
| ] | ||
| }, | ||
| "lib": [ | ||
| "esnext", | ||
| "dom", | ||
| "dom.iterable", | ||
| "scripthost" | ||
| ] | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to run as non-root