ofvp_Server/Dockerfile

79 lines
3.9 KiB
Docker

FROM ubuntu:latest AS base
ENV DEBIAN_FRONTEND="noninteractive"
LABEL name="OFVp Server"
LABEL org.opencontainers.image.title="OFVp Server"
LABEL org.opencontainers.image.description="Start a server for Http Injector in the fastest and easiest way to maintain and update as new tools are released and your host does not need to restart with all new changes."
LABEL org.opencontainers.image.vendor="Sirherobrine23"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/OFVp-Project/Server.git"
# Ports
EXPOSE 22/tcp 51820/udp 3000/tcp
# Install Core Packages
RUN apt update && apt -y install build-essential wget curl git unzip zip zsh sudo jq nano ca-certificates net-tools bc lsof zlib1g-dev ifupdown iputils-ping iproute2 openssl procps openresolv inotify-tools gnupg libc6 libelf-dev perl pkg-config
# Install Openssh Server
RUN apt update && apt install -y openssh-server && \
rm -fv /etc/ssh/sshd_config /etc/ssh/ssh_host_*
# Install Wireguard
RUN apt-get -y install debconf-utils && \
echo resolvconf resolvconf/linkify-resolvconf boolean false | debconf-set-selections && \
apt-get -y install resolvconf && \
apt -y install wireguard-tools iptables iproute2 resolvconf qrencode dkms wireguard
# Install latest NodeJS
RUN \
NODEVERSION=$(curl -sL https://api.github.com/repos/nodejs/node/releases | grep tag_name | cut -d '"' -f 4 | sort -V | tail -n 1) && \
case $(uname -m) in \
x86_64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-x64.tar.xz" -O /tmp/node.tar.xz;; \
aarch64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-arm64.tar.xz" -O /tmp/node.tar.xz;; \
armv7l ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-armv7l.tar.xz" -O /tmp/node.tar.xz;; \
ppc64el ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-ppc64le.tar.xz" -O /tmp/node.tar.xz;; \
s390x ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-s390x.tar.xz" -O /tmp/node.tar.xz;; \
*) echo "Unsupported architecture"; exit 1;; \
esac && \
mkdir /tmp/Node && \
tar -xJf /tmp/node.tar.xz -C /tmp/Node && \
rm -rf /tmp/node.tar.xz && \
cp -rf /tmp/Node/*/* /usr && \
rm -rf /tmp/Node && \
npm -g install npm@latest
FROM base AS devcontainer
# Add user and setup User
RUN adduser --disabled-password --gecos "" --shell /usr/bin/zsh gitpod && \
usermod -aG sudo gitpod && echo "gitpod ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Install Docker and Docker Compose
RUN curl https://get.docker.com | sh && \
compose_version="$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d \" -f 4)"; \
wget https://github.com/docker/compose/releases/download/${compose_version}/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose
RUN mkdir /workspace && \
chown -Rv gitpod:gitpod /workspace && \
chmod 7777 -Rv /workspace && \
apt install mongodb-server -y && usermod -aG docker gitpod
USER gitpod
WORKDIR /home/gitpod
# Install oh my zsh
RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" && \
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && \
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && \
sed -e 's|ZSH_THEME=".*"|ZSH_THEME="strug"|g' -i ~/.zshrc && \
sed -e 's|plugins=(.*)|plugins=(git docker zsh-syntax-highlighting zsh-autosuggestions)|g' -i ~/.zshrc
# Server Entrys
FROM base AS server
WORKDIR /usr/src/Backend
COPY package*.json ./
RUN npm install --no-save
ENTRYPOINT [ "node", "--trace-warnings", "src/index.js" ]
ENV MongoDB_URL="mongodb://localhost:27017" \
NODE_ENV="production" \
COOKIE_SECRET="OFVpServer" \
START_OPENSSH="1" \
START_WIREGUARD="1"
COPY ./ ./