2023-11-02 13:02:33 +00:00
|
|
|
FROM oven/bun:alpine as base
|
|
|
|
LABEL Maintainer="Shahrad Elahi <https://github.com/shahradelahi>"
|
2023-11-05 16:20:21 +00:00
|
|
|
WORKDIR /app
|
2023-09-06 10:23:31 +00:00
|
|
|
|
2023-09-24 19:18:39 +00:00
|
|
|
ENV TZ=UTC
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
2023-09-06 10:23:31 +00:00
|
|
|
|
2023-09-27 07:01:52 +00:00
|
|
|
COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/obfs4proxy /usr/local/bin/obfs4proxy
|
|
|
|
COPY --from=chriswayg/tor-alpine:latest /usr/local/bin/meek-server /usr/local/bin/meek-server
|
|
|
|
|
2023-11-05 16:20:21 +00:00
|
|
|
COPY /config/torrc /etc/tor/torrc
|
2023-11-07 19:06:03 +00:00
|
|
|
COPY /config/tor-bridges /etc/tor/bridges
|
2023-11-05 16:20:21 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
# Set the mirror list
|
|
|
|
RUN echo "https://uk.alpinelinux.org/alpine/latest-stable/main" > /etc/apk/repositories && \
|
|
|
|
echo "https://mirror.bardia.tech/alpine/latest-stable/main" >> /etc/apk/repositories && \
|
|
|
|
echo "https://uk.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories &&\
|
|
|
|
echo "https://mirror.bardia.tech/alpine/latest-stable/community" >> /etc/apk/repositories
|
|
|
|
|
|
|
|
# Update and upgrade packages
|
|
|
|
RUN apk update && apk upgrade
|
|
|
|
|
|
|
|
# Install required packages
|
2023-09-06 10:23:31 +00:00
|
|
|
RUN apk add -U --no-cache \
|
2023-11-02 13:02:33 +00:00
|
|
|
iproute2 iptables net-tools \
|
|
|
|
screen vim curl bash \
|
|
|
|
wireguard-tools \
|
|
|
|
openssl \
|
|
|
|
dumb-init \
|
|
|
|
tor \
|
|
|
|
redis
|
2023-09-06 10:23:31 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
# Clear cache
|
|
|
|
RUN rm -rf /var/cache/apk/*
|
2023-09-06 10:23:31 +00:00
|
|
|
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
FROM base AS deps
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
RUN mkdir -p /temp/dev
|
|
|
|
COPY web/package.json web/bun.lockb /temp/dev/
|
|
|
|
RUN cd /temp/dev && bun install --frozen-lockfile
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
RUN mkdir -p /temp/prod
|
|
|
|
COPY web/package.json web/bun.lockb /temp/prod/
|
|
|
|
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-09-06 10:23:31 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
FROM base AS build
|
|
|
|
COPY --from=deps /temp/dev/node_modules node_modules
|
|
|
|
COPY web .
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
# build
|
2023-09-24 19:18:39 +00:00
|
|
|
ENV NODE_ENV=production
|
2023-11-02 13:02:33 +00:00
|
|
|
RUN bun run build
|
2023-09-24 19:18:39 +00:00
|
|
|
|
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
FROM base AS release
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
COPY --from=deps /temp/prod/node_modules node_modules
|
2023-11-05 16:20:21 +00:00
|
|
|
COPY --from=build /app/build .
|
|
|
|
COPY --from=build /app/package.json .
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
ENV NODE_ENV=production
|
2023-09-24 19:18:39 +00:00
|
|
|
|
2023-11-05 16:20:21 +00:00
|
|
|
COPY docker-entrypoint.sh /usr/bin/entrypoint
|
|
|
|
RUN chmod +x /usr/bin/entrypoint
|
|
|
|
ENTRYPOINT ["/usr/bin/entrypoint"]
|
|
|
|
|
2023-11-07 19:01:12 +00:00
|
|
|
HEALTHCHECK --interval=60s --timeout=3s --start-period=20s --retries=3 \
|
|
|
|
CMD curl -f http://127.0.0.1:3000/api/health || exit 1
|
|
|
|
|
2023-11-02 13:02:33 +00:00
|
|
|
# run the app
|
|
|
|
USER bun
|
2023-09-24 19:18:39 +00:00
|
|
|
EXPOSE 3000/tcp
|
2023-11-02 13:02:33 +00:00
|
|
|
CMD [ "bun", "start" ]
|