easier manager layers, frontend with nginx

This commit is contained in:
Shihaam Abdul Rahman 2022-12-20 23:14:02 +05:00
parent 02c85fce39
commit b3a909cebe
Signed by: shihaam
GPG Key ID: 3B007D22E5584980
2 changed files with 20 additions and 7 deletions

View File

@ -16,16 +16,28 @@ RUN apt install git ca-certificates lsb-release apt-transport-https wget curl na
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
#Get the repos
RUN git clone https://git.shihaam.dev/shihaam/okiba-org-frontend \
&& git clone https://git.shihaam.dev/shihaam/okiba-org-backend \
#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 \
&& 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 \
&& cd /root/okiba-org-frontend ; pnpm install ; pnpm run build
&& wget -O words.txt https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt
# configure frontend
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 .

View File

@ -1,8 +1,9 @@
#!/bin/bash
source $HOME/.profile; source $HOME/.bashrc
#Start frontend
cd /root/okiba-org-frontend; pnpm run dev --host &
/usr/sbin/nginx -g 'daemon off; master_process on;' &
#Start backend
cd /root/okiba-org-backend; pnpm start &