wireadmin/Dockerfile-Dev
2024-04-26 23:16:07 +03:30

67 lines
1.6 KiB
Plaintext

ARG ALPINE_VERSION=3.19
ARG NODE_VERSION=20
FROM --platform=$BUILDPLATFORM chriswayg/tor-alpine:latest as tor
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-alpine${ALPINE_VERSION} as base
LABEL Maintainer="Shahrad Elahi <https://github.com/shahradelahi>"
WORKDIR /app
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY --from=tor /usr/local/bin/obfs4proxy /usr/local/bin/obfs4proxy
COPY --from=tor /usr/local/bin/meek-server /usr/local/bin/meek-server
# Install required packages
RUN apk add -U --no-cache \
iproute2 iptables net-tools \
screen vim curl bash \
wireguard-tools \
tor &&\
# NPM packages
npm install -g @litehex/node-checksum@0.2 &&\
# Clear APK cache
rm -rf /var/cache/apk/*
# Copy Tor Configs
COPY /config/torrc.template /etc/tor/torrc.template
COPY /config/obfs4-bridges.conf /etc/torrc.d/obfs4-bridges.conf
# Copy user scripts
COPY /bin /usr/local/bin
RUN chmod -R +x /usr/local/bin
# Setup Pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
# Base env
ENV PROTOCOL_HEADER=x-forwarded-proto
ENV HOST_HEADER=x-forwarded-host
FROM base AS runner
ENV VERSION=0.0.0-dev
ENV NODE_ENV=development
ENV LOG_LEVEL=debug
# Fix permissions
RUN mkdir -p /data && chmod 700 /data
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
# Setup entrypoint
COPY docker-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Volumes
VOLUME ["/etc/torrc.d", "/data", "/var/vlogs"]
# Run the app
EXPOSE 5173/tcp
CMD [ "npm", "run", "dev", "--", "--host" ]