This commit is contained in:
Shahrad Elahi 2023-09-24 22:48:39 +03:30
parent 789f7088f8
commit e79f52da9f
5 changed files with 59 additions and 43 deletions

View File

@ -1 +1,2 @@
**/node_modules/** .idea
node_modules

View File

@ -1,40 +1,53 @@
FROM docker.io/library/node:alpine AS deps FROM node:alpine as base
WORKDIR /app WORKDIR /app
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY --from=golang:1.20-alpine /usr/local/go/ /usr/local/go/
COPY --from=gogost/gost:3.0.0-rc8 /bin/gost /usr/local/bin/gost
RUN apk add -U --no-cache \
iproute2 iptables net-tools \
screen vim curl bash \
wireguard-tools \
dumb-init \
tor \
redis
FROM node:alpine as builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
ENV NODE_ENV=production
COPY /src/ .
RUN npm run build
FROM base
WORKDIR /app
ENV NODE_ENV=production
LABEL Maintainer="Shahrad Elahi <https://github.com/shahradelahi>" LABEL Maintainer="Shahrad Elahi <https://github.com/shahradelahi>"
COPY /config/torrc /etc/tor/torrc
COPY src/package.json src/pnpm-lock.yaml ./ COPY --from=builder /app/.build ./.build
RUN npm i -g pnpm COPY --from=builder /app/.next ./.next
RUN pnpm i --frozen-lockfile COPY --from=builder /app/next.config.js ./next.config.js
COPY --from=builder /app/public ./public
# Copy build result to a new image. COPY package.json package-lock.json ./
# This saves a lot of disk space. RUN npm install
FROM docker.io/library/node:alpine as runner
WORKDIR /app
# Move node_modules one directory up, so during development
# we don't have to mount it in a volume.
# This results in much faster reloading!
#
# Also, some node_modules might be native, and
# the architecture & OS of your development machine might differ
# than what runs inside of docker.
COPY src/ /app/
COPY --from=deps /opt/app/node_modules ./node_modules
# Install Linux packages
RUN apk add -U --no-cache \
wireguard-tools \
dumb-init \
iptables
# Expose UI Ports
EXPOSE 3000/tcp EXPOSE 3000/tcp
# Set Environment COPY docker-entrypoint.sh /usr/bin/entrypoint
ENV DEBUG=Server,WireGuard ENTRYPOINT ["/usr/bin/entrypoint"]
# Run Web UI CMD ["npm", "run", "start"]
WORKDIR /app
CMD ["/usr/bin/dumb-init", "node", "server.js"]

View File

@ -1,14 +1,11 @@
FROM docker.io/library/node:alpine FROM node:alpine as base
WORKDIR /app WORKDIR /app
ENV TZ=UTC ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY --from=golang:1.20-alpine /usr/local/go/ /usr/local/go/ COPY --from=golang:1.20-alpine /usr/local/go/ /usr/local/go/
COPY --from=gogost/gost /bin/gost /usr/local/bin/gost COPY --from=gogost/gost:3.0.0-rc8 /bin/gost /usr/local/bin/gost
COPY /src/ /app/
COPY /config/torrc /etc/tor/torrc
RUN apk add -U --no-cache \ RUN apk add -U --no-cache \
iproute2 iptables net-tools \ iproute2 iptables net-tools \
@ -18,9 +15,16 @@ RUN apk add -U --no-cache \
tor \ tor \
redis redis
FROM base
WORKDIR /app
COPY /src/ /app/
COPY /config/torrc /etc/tor/torrc
EXPOSE 3000/tcp EXPOSE 3000/tcp
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY docker-entrypoint.sh /usr/bin/entrypoint
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["npm", "run", "dev"] CMD ["npm", "run", "dev"]

View File

@ -7,12 +7,10 @@ import useSWRMutation from "swr/mutation";
import { AddressSchema, DnsSchema, MtuSchema, NameSchema, PortSchema, TypeSchema } from "@lib/schemas/WireGuard"; import { AddressSchema, DnsSchema, MtuSchema, NameSchema, PortSchema, TypeSchema } from "@lib/schemas/WireGuard";
import { zodErrorMessage } from "@lib/zod"; import { zodErrorMessage } from "@lib/zod";
export type CreateClientModalProps = {}
const CreateClientModal = React.forwardRef< const CreateClientModal = React.forwardRef<
SmartModalRef, SmartModalRef,
CreateClientModalProps {}
>((props, ref) => { >((_, ref) => {
const [ notificationApi, contextHolder ] = notification.useNotification() const [ notificationApi, contextHolder ] = notification.useNotification()

View File

@ -20,7 +20,7 @@ export default function PageHeader(props: PageHeaderProps) {
<div className={'flex items-center gap-x-2'}> <div className={'flex items-center gap-x-2'}>
<Link <Link
href={'https://github.com/shahradelahi/tsetmc-client'} href={'https://github.com/shahradelahi/wireadmin'}
title={'Giv me a star on Github'} title={'Giv me a star on Github'}
> >
<img <img