Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions images/vuejs/Debian/.dockerignore
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
48 changes: 48 additions & 0 deletions images/vuejs/Debian/Dockerfile
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"]
Copy link
Member

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

12 changes: 12 additions & 0 deletions images/vuejs/Debian/nginx.conf
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;
}
}
10 changes: 10 additions & 0 deletions images/vuejs/Debian/supervisord.conf
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
23 changes: 23 additions & 0 deletions images/vuejs/code/.gitignore
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?
24 changes: 24 additions & 0 deletions images/vuejs/code/README.md
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/).
5 changes: 5 additions & 0 deletions images/vuejs/code/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
19 changes: 19 additions & 0 deletions images/vuejs/code/jsconfig.json
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"
]
}
}
Loading