Skip to content

Commit

Permalink
feat: add docker proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Apr 8, 2023
1 parent 40b8b22 commit c8be5e4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM node:18-alpine AS base
FROM base AS deps

RUN apk add --no-cache libc6-compat
RUN apk --no-cache add proxychains-ng

WORKDIR /app

Expand All @@ -27,6 +28,7 @@ RUN yarn build
FROM base AS runner
WORKDIR /app

ENV PROXY_URL=""
ENV OPENAI_API_KEY=""
ENV CODE=""

Expand All @@ -37,4 +39,12 @@ COPY --from=builder /app/.next/server ./.next/server

EXPOSE 3000

CMD ["node","server.js"]
CMD if [ -n "$PROXY_URL" ]; then \
protocol=$(echo $PROXY_URL | cut -d: -f1); \
host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
port=$(echo $PROXY_URL | cut -d: -f3); \
echo "$protocol $host $port" >> /etc/proxychains.conf; \
proxychains node server.js; \
else \
node server.js; \
fi

0 comments on commit c8be5e4

Please sign in to comment.