ARG BRANCH="main" | |
# Use the latest slim version of Debian | |
FROM debian:bookworm-slim | |
# Check if the argument is provided, else throw an error | |
ARG BRANCH | |
RUN if [ -z "$BRANCH" ]; then echo "ERROR: BRANCH is not set!" >&2; exit 1; fi | |
ENV BRANCH=$BRANCH | |
# Set locale to en_US.UTF-8 and timezone to UTC | |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales tzdata | |
RUN sed -i -e 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen && \ | |
dpkg-reconfigure --frontend=noninteractive locales && \ | |
update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 | |
RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime | |
RUN echo "UTC" > /etc/timezone | |
RUN dpkg-reconfigure -f noninteractive tzdata | |
ENV LANG=en_US.UTF-8 | |
ENV LANGUAGE=en_US:en | |
ENV LC_ALL=en_US.UTF-8 | |
ENV TZ=UTC | |
# Copy contents of the project to /a0 | |
COPY ./fs/ / | |
# pre installation steps | |
RUN bash /ins/pre_install.sh $BRANCH | |
# install A0 | |
RUN bash /ins/install_A0.sh $BRANCH | |
# install additional software | |
RUN bash /ins/install_additional.sh $BRANCH | |
# cleanup repo and install A0 without caching, this speeds up builds | |
ARG CACHE_DATE=none | |
RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh $BRANCH | |
# post installation steps | |
RUN bash /ins/post_install.sh $BRANCH | |
# Expose ports | |
EXPOSE 22 80 | |
RUN chmod +x /exe/initialize.sh /exe/run_A0.sh /exe/run_searxng.sh /exe/run_tunnel_api.sh | |
# initialize runtime and switch to supervisord | |
CMD ["/exe/initialize.sh", "$BRANCH"] | |