okiba/Dockerfile

49 lines
1.6 KiB
Docker

FROM debian:11-slim
# set work dir
WORKDIR /root/
# Set build shell to bash, default has has some issues sometimes
SHELL ["/bin/bash", "-c"]
RUN apt update && apt upgrade -y
# Language setup and Initial repo update
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt install git ca-certificates lsb-release apt-transport-https wget curl nano vim locales -y \
&& apt auto-remove -y \
&& apt clean -y
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
#Install nginx, node and pnpm
RUN apt install nginx -y --no-install-recommends \
&& curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash \
&& curl -fsSL https://get.pnpm.io/install.sh | bash \
&& source ~/.profile && source ~/.bashrc \
&& nvm install node
# Clone repos
RUN git clone https://git.shihaam.dev/shihaam/okiba-org-frontend \
&& git clone https://git.shihaam.dev/shihaam/okiba-org-backend
# configure backend
RUN source ~/.profile && source ~/.bashrc \
&& cd /root/okiba-org-backend ; pnpm build \
&& wget -O words.txt https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt
# configure frontend
COPY buildfiles/frontend-env /root/okiba-org-frontend/.env.local
RUN source ~/.profile && source ~/.bashrc \
&& cd /root/okiba-org-frontend ; pnpm install ; pnpm build ; cd - \
&& mv /root/okiba-org-frontend/dist/* /var/www/html/ \
&& rm -rfv /root/okiba-org-frontend/ /var/www/html/index.nginx-debian.html
# Copy Start Services
COPY buildfiles/start_services.sh .
RUN chmod +x start_services.sh
# Start service
CMD ["./start_services.sh"]