wireadmin/Dockerfile-Dev

52 lines
1.3 KiB
Plaintext

ARG ALPINE_VERSION=3.19
ARG NODE_VERSION=20
FROM --platform=$BUILDPLATFORM shahradel/torproxy:latest AS tor
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS node
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apk update \
&& apk upgrade \
&& apk add -U --no-cache \
iptables net-tools \
screen logrotate bash \
wireguard-tools \
dnsmasq \
tor \
&& rm -rf /var/cache/apk/*
FROM node
WORKDIR /app
# Setup Pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
ENV NODE_ENV=development
ENV LOG_LEVEL=debug
ENV PROTOCOL_HEADER=x-forwarded-proto
ENV HOST_HEADER=x-forwarded-host
COPY --from=tor /usr/local/bin/lyrebird /usr/local/bin/lyrebird
COPY rootfs /
# Fix permissions
RUN mkdir -p /data/ && chmod 700 /data/
RUN mkdir -p /etc/tor/torrc.d/ && chmod -R 400 /etc/tor/
RUN mkdir -p /var/log/wireadmin/ && touch /var/log/wireadmin/web.log
RUN echo '* * * * * /usr/bin/env logrotate /etc/logrotate.d/rotator' > /etc/crontabs/root
# Setup entrypoint
COPY docker-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Volumes
VOLUME ["/etc/tor", "/var/lib/tor", "/data"]
# Run the app
EXPOSE 5173/tcp
CMD [ "npm", "run", "dev", "--", "--host" ]