feat: add dockerized 3proxy control plane backend
This commit is contained in:
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
||||
FROM node:22-bookworm-slim AS app-build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install
|
||||
|
||||
COPY tsconfig.json tsconfig.app.json tsconfig.node.json tsconfig.server.json vite.config.ts index.html ./
|
||||
COPY public ./public
|
||||
COPY src ./src
|
||||
COPY server ./server
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM debian:bookworm-slim AS proxy-build
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends build-essential ca-certificates git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /tmp
|
||||
RUN git clone --depth=1 https://github.com/3proxy/3proxy.git
|
||||
|
||||
WORKDIR /tmp/3proxy
|
||||
RUN ln -s Makefile.Linux Makefile && make
|
||||
|
||||
FROM node:22-bookworm-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV AUTO_START_3PROXY=true
|
||||
ENV THREEPROXY_BINARY=/usr/local/bin/3proxy
|
||||
ENV RUNTIME_DIR=/app/runtime
|
||||
|
||||
COPY --from=app-build /app/dist ./dist
|
||||
COPY --from=app-build /app/server-dist ./server-dist
|
||||
COPY --from=proxy-build /tmp/3proxy/bin/3proxy /usr/local/bin/3proxy
|
||||
|
||||
RUN mkdir -p /app/runtime/generated /app/runtime/state/reports /app/runtime/logs
|
||||
|
||||
EXPOSE 3000 1080 2080 3128 8081
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
||||
CMD node -e "fetch('http://127.0.0.1:3000/api/health').then((r)=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"
|
||||
|
||||
CMD ["node", "server-dist/index.cjs"]
|
||||
Reference in New Issue
Block a user