mirror of
https://github.com/wireadmin/wireadmin
synced 2025-02-26 05:48:44 +00:00
chore: add dev docs
This commit is contained in:
parent
65ef4bba92
commit
19c0788fa9
18
Dockerfile
18
Dockerfile
@ -9,9 +9,9 @@ COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/obfs4proxy /usr/local/bin
|
|||||||
COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/meek-server /usr/local/bin/meek-server
|
COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/meek-server /usr/local/bin/meek-server
|
||||||
|
|
||||||
# Update and upgrade packages
|
# Update and upgrade packages
|
||||||
RUN apk update && apk upgrade \
|
RUN apk update && apk upgrade &&\
|
||||||
# Install required packages
|
# Install required packages
|
||||||
&& apk add -U --no-cache \
|
apk add -U --no-cache \
|
||||||
iproute2 iptables net-tools \
|
iproute2 iptables net-tools \
|
||||||
screen curl bash \
|
screen curl bash \
|
||||||
wireguard-tools \
|
wireguard-tools \
|
||||||
@ -23,14 +23,21 @@ RUN apk update && apk upgrade \
|
|||||||
|
|
||||||
COPY /config/torrc /etc/tor/torrc
|
COPY /config/torrc /etc/tor/torrc
|
||||||
|
|
||||||
|
# Copy user scripts
|
||||||
COPY /bin /usr/local/bin
|
COPY /bin /usr/local/bin
|
||||||
RUN chmod -R +x /usr/local/bin
|
RUN chmod -R +x /usr/local/bin
|
||||||
|
|
||||||
COPY web/package.json web/pnpm-lock.yaml ./
|
COPY web/package.json web/pnpm-lock.yaml ./
|
||||||
|
|
||||||
|
# Base env
|
||||||
|
ENV ORIGIN=http://127.0.0.1:3000
|
||||||
|
ENV PROTOCOL_HEADER=x-forwarded-proto
|
||||||
|
ENV HOST_HEADER=x-forwarded-host
|
||||||
|
|
||||||
|
|
||||||
FROM base AS build
|
FROM base AS build
|
||||||
|
|
||||||
|
# Setup Pnpm - Pnpm only used for build stage
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
@ -51,25 +58,30 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
|||||||
|
|
||||||
FROM base AS release
|
FROM base AS release
|
||||||
|
|
||||||
|
# Copy the goods from the build stage
|
||||||
COPY --from=build /tmp/node_modules node_modules
|
COPY --from=build /tmp/node_modules node_modules
|
||||||
COPY --from=build /tmp/build build
|
COPY --from=build /tmp/build build
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV LOG_LEVEL=error
|
ENV LOG_LEVEL=error
|
||||||
|
|
||||||
|
# Setup entrypoint
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
COPY docker-entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
|
# Healthcheck
|
||||||
HEALTHCHECK --interval=60s --timeout=3s --start-period=20s --retries=3 \
|
HEALTHCHECK --interval=60s --timeout=3s --start-period=20s --retries=3 \
|
||||||
CMD curl -f http://127.0.0.1:3000/api/health || exit 1
|
CMD curl -f http://127.0.0.1:3000/api/health || exit 1
|
||||||
|
|
||||||
|
# Fix permissions
|
||||||
RUN mkdir -p /data && chmod 700 /data
|
RUN mkdir -p /data && chmod 700 /data
|
||||||
RUN mkdir -p /etc/torrc.d && chmod -R 400 /etc/torrc.d
|
RUN mkdir -p /etc/torrc.d && chmod -R 400 /etc/torrc.d
|
||||||
RUN mkdir -p /var/vlogs && touch /var/vlogs/web && chmod -R 600 /var/vlogs
|
RUN mkdir -p /var/vlogs && touch /var/vlogs/web && chmod -R 600 /var/vlogs
|
||||||
|
|
||||||
|
# Volumes
|
||||||
VOLUME ["/etc/torrc.d", "/data", "/var/vlogs"]
|
VOLUME ["/etc/torrc.d", "/data", "/var/vlogs"]
|
||||||
|
|
||||||
# run the app
|
# Run the app
|
||||||
EXPOSE 3000/tcp
|
EXPOSE 3000/tcp
|
||||||
CMD [ "npm", "run", "start" ]
|
CMD [ "npm", "run", "start" ]
|
||||||
|
@ -9,9 +9,9 @@ COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/obfs4proxy /usr/local/bin
|
|||||||
COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/meek-server /usr/local/bin/meek-server
|
COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/meek-server /usr/local/bin/meek-server
|
||||||
|
|
||||||
# Update and upgrade packages
|
# Update and upgrade packages
|
||||||
RUN apk update && apk upgrade \
|
RUN apk update && apk upgrade &&\
|
||||||
# Install required packages
|
# Install required packages
|
||||||
&& apk add -U --no-cache \
|
apk add -U --no-cache \
|
||||||
iproute2 iptables net-tools \
|
iproute2 iptables net-tools \
|
||||||
screen vim curl bash \
|
screen vim curl bash \
|
||||||
wireguard-tools \
|
wireguard-tools \
|
||||||
@ -21,22 +21,31 @@ RUN apk update && apk upgrade \
|
|||||||
# Clear APK cache
|
# Clear APK cache
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Copy Tor Configs
|
||||||
COPY /config/torrc /etc/tor/torrc
|
COPY /config/torrc /etc/tor/torrc
|
||||||
COPY /config/obfs4-bridges.conf /etc/torrc.d/obfs4-bridges.conf
|
COPY /config/obfs4-bridges.conf /etc/torrc.d/obfs4-bridges.conf
|
||||||
|
|
||||||
|
# Copy user scripts
|
||||||
COPY /bin /usr/local/bin
|
COPY /bin /usr/local/bin
|
||||||
RUN chmod -R +x /usr/local/bin
|
RUN chmod -R +x /usr/local/bin
|
||||||
|
|
||||||
|
# Setup Pnpm
|
||||||
FROM base AS runner
|
|
||||||
|
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
|
# Base env
|
||||||
|
ENV ORIGIN=http://127.0.0.1:5173,http://localhost:5173
|
||||||
|
ENV PROTOCOL_HEADER=x-forwarded-proto
|
||||||
|
ENV HOST_HEADER=x-forwarded-host
|
||||||
|
|
||||||
|
|
||||||
|
FROM base AS runner
|
||||||
|
|
||||||
ENV NODE_ENV=development
|
ENV NODE_ENV=development
|
||||||
ENV LOG_LEVEL=debug
|
ENV LOG_LEVEL=debug
|
||||||
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
COPY docker-entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
@ -7,8 +7,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5173:5173"
|
- "5173:5173"
|
||||||
environment:
|
environment:
|
||||||
- UI_PASSWORD=password
|
|
||||||
- WG_HOST=192.168.1.102
|
- WG_HOST=192.168.1.102
|
||||||
|
- UI_PASSWORD=password
|
||||||
- TOR_SOCKS5_PROXY=host.docker.internal:8080
|
- TOR_SOCKS5_PROXY=host.docker.internal:8080
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
@ -4,16 +4,19 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
# ⚠️ Required:
|
# ⚠️ Required:
|
||||||
# Make sure change this to your host's public address
|
# Make sure change this to your host's public address
|
||||||
- WG_HOST=raspberrypi.local
|
- WG_HOST=localhost
|
||||||
|
# ⚠️ Required:
|
||||||
|
# You can use `openssl rand -base64 8` to generate a secure password
|
||||||
|
- UI_PASSWORD=super-secret-password
|
||||||
|
|
||||||
image: shahradel/wireadmin
|
image: wireadmin
|
||||||
container_name: wireadmin
|
container_name: litehex/wireadmin
|
||||||
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- redis-data:/data
|
- persist-data:/data
|
||||||
ports:
|
ports:
|
||||||
- "51820:51820/udp"
|
- "51820:51820/udp"
|
||||||
- "3000:3000/tcp"
|
- "3000:3000/tcp"
|
||||||
restart: unless-stopped
|
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
- SYS_MODULE
|
- SYS_MODULE
|
||||||
@ -22,5 +25,5 @@ services:
|
|||||||
- net.ipv4.conf.all.src_valid_mark=1
|
- net.ipv4.conf.all.src_valid_mark=1
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
redis-data:
|
persist-data:
|
||||||
driver: local
|
driver: local
|
@ -3,8 +3,10 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:image": "DOCKER_BUILDKIT=1 docker build --tag wireadmin -f Dockerfile-Dev .",
|
"dev": "docker compose rm -fsv && docker compose -f docker-compose.yml -f docker-compose.dev.yml up",
|
||||||
"dev": "docker compose rm -fsv && docker compose -f docker-compose.yml -f docker-compose.dev.yml up"
|
"dev:image": "docker buildx build --tag wireadmin -f Dockerfile-Dev .",
|
||||||
|
"build": "docker buildx build --tag wireadmin .",
|
||||||
|
"start": "docker compose rm -fsv && docker compose -f docker-compose.yml up"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Shahrad Elahi <https://github.com/shahradelahi>",
|
"author": "Shahrad Elahi <https://github.com/shahradelahi>",
|
||||||
|
@ -3,15 +3,15 @@
|
|||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "NODE_ENV=development vite dev",
|
"dev": "vite dev",
|
||||||
"build": "NODE_ENV=build vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
"test": "mocha",
|
"test": "mocha",
|
||||||
"check:format": "prettier --check .",
|
"check:format": "prettier --check .",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"start": "NODE_ENV=production node ./build/index.js"
|
"start": "node ./build/index.js"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.15.0",
|
"packageManager": "pnpm@8.15.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
Loading…
Reference in New Issue
Block a user