Skip to content

Commit

Permalink
Improved local development and Dockerfile (wg-easy#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
pheiduck authored Apr 30, 2024
2 parents 4cc07c5 + a25d287 commit 7d05a82
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 8 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/node_modules
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
FROM docker.io/library/node:18-alpine AS build_node_modules

# Copy Web UI
COPY src/ /app/
COPY src /app
WORKDIR /app
RUN npm ci --omit=dev &&\
# Enable this to run `npm run serve`
npm i -g nodemon &&\
# Delete unnecessary files
npm cache clean --force && rm -rf ~/.npm &&\
mv node_modules /node_modules

# Copy build result to a new image.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "1.0.1",
"scripts": {
"build": "DOCKER_BUILDKIT=1 docker build --tag wg-easy .",
"serve": "docker-compose -f docker-compose.yml -f docker-compose.dev.yml up",
"serve": "docker compose -f docker-compose.yml -f docker-compose.dev.yml up",
"start": "docker run --env WG_HOST=0.0.0.0 --name wg-easy --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl=\"net.ipv4.conf.all.src_valid_mark=1\" --mount type=bind,source=\"$(pwd)\"/config,target=/etc/wireguard -p 51820:51820/udp -p 51821:51821/tcp wg-easy"
}
}
135 changes: 135 additions & 0 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "The easiest way to run WireGuard VPN + Web-based Admin UI.",
"main": "server.js",
"scripts": {
"serve": "DEBUG=Server,WireGuard nodemon server.js",
"serve": "DEBUG=Server,WireGuard npx nodemon server.js",
"serve-with-password": "PASSWORD=wg npm run serve",
"lint": "eslint .",
"buildcss": "npx tailwindcss -i ./www/src/css/app.css -o ./www/css/app.css"
Expand All @@ -22,6 +22,7 @@
},
"devDependencies": {
"eslint-config-athom": "^3.1.3",
"nodemon": "^3.1.0",
"tailwindcss": "^3.4.3"
},
"nodemonConfig": {
Expand Down
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ process.on('SIGTERM', async () => {
process.exit(0);
});

// Handle interupt signal
// Handle interrupt signal
process.on('SIGINT', () => {
// eslint-disable-next-line no-console
console.log('SIGINT signal received.');
Expand Down

0 comments on commit 7d05a82

Please sign in to comment.