diff --git a/Dockerfile b/Dockerfile index 9c0221e..179ec87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,7 @@ RUN npm install EXPOSE 3000/tcp COPY docker-entrypoint.sh /usr/bin/entrypoint +RUN chmod +x /usr/bin/entrypoint ENTRYPOINT ["/usr/bin/entrypoint"] CMD ["npm", "run", "start"] diff --git a/Dockerfile-Dev b/Dockerfile-Dev index 61205ad..ae83573 100644 --- a/Dockerfile-Dev +++ b/Dockerfile-Dev @@ -25,6 +25,7 @@ COPY /config/torrc /etc/tor/torrc EXPOSE 3000/tcp COPY docker-entrypoint.sh /usr/bin/entrypoint +RUN chmod +x /usr/bin/entrypoint ENTRYPOINT ["/usr/bin/entrypoint"] CMD ["npm", "run", "dev"] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 1312536..8288d34 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -4,6 +4,9 @@ services: image: wireadmin volumes: - ./src/:/app/ + ports: + - "4040:4040/udp" # Direct + - "4050:4050/udp" # Tor environment: - UI_PASSWORD=password - - WG_HOST=192.168.1.233 + - WG_HOST=127.0.0.1 diff --git a/docker-compose.yml b/docker-compose.yml index b829c4d..9b1781a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,18 +6,6 @@ services: # Change this to your host's public address - WG_HOST=raspberrypi.local - # Optional: - # - UI_PASSWORD=foobar123 - # - WG_PORT=51820 - # - WG_DEFAULT_ADDRESS=10.8.0.x - # - WG_DEFAULT_DNS=1.1.1.1 - # - WG_MTU=1420 - # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 - # - WG_PRE_UP=echo "Pre Up" > /etc/wireguard/pre-up.txt - # - WG_POST_UP=echo "Post Up" > /etc/wireguard/post-up.txt - # - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt - # - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt - image: shahradel/wireadmin container_name: wireadmin volumes: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 6c424af..625946b 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -21,4 +21,9 @@ screen -dmS redis bash -c "redis-server --port 6479 --daemonize no --dir /data - # Start Tor in the background screen -dmS tor bash -c "tor -f /etc/tor/torrc" +# If WG_HOST exists, again export it as NEXT_PUBLIC_WG_HOST +if [ ! -z "$WG_HOST" ]; then + export NEXT_PUBLIC_WG_HOST=$WG_HOST +fi + exec "$@" diff --git a/src/next.config.js b/src/next.config.js index fdda6aa..3e74393 100644 --- a/src/next.config.js +++ b/src/next.config.js @@ -1,4 +1,15 @@ -module.exports = { +function publicENV(ex = {}) { + Object.entries(process.env) + .filter(([ key ]) => key.startsWith('NEXT_PUBLIC_')) + .forEach(([ key, value ]) => ex[key] = value) + return ex +} + +/** @type {import('next').NextConfig} */ +const nextConfig = { reactStrictMode: true, - transpilePackages: ["ui"], -}; + transpilePackages: [], + env: publicENV() +} + +module.exports = nextConfig;