Compare commits

...

7 Commits

5 changed files with 30 additions and 21 deletions

View File

@ -16,16 +16,29 @@ 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 \ RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen && locale-gen
#Get the repos
RUN git clone https://git.shihaam.dev/shihaam/okiba-org-frontend \ #Install nginx, node and pnpm
&& git clone https://git.shihaam.dev/shihaam/okiba-org-backend \ RUN apt install nginx -y --no-install-recommends \
&& curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash \ && curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash \
&& curl -fsSL https://get.pnpm.io/install.sh | bash \ && curl -fsSL https://get.pnpm.io/install.sh | bash \
&& source ~/.profile && source ~/.bashrc \ && 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 \ && cd /root/okiba-org-backend ; pnpm build \
&& wget -O words.txt https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt \ && 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
# 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 Start Services
COPY buildfiles/start_services.sh . COPY buildfiles/start_services.sh .

View File

@ -8,14 +8,14 @@ services:
######################### #########################
okiba: okiba:
hostname: okiba hostname: okiba
image: git.shihaam.dev/dockerfiles/okiba-org-docker image: git.shihaam.dev/dockerfiles/okiba
volumes: volumes:
- $PWD/backend-env:/root/okiba-org-backend/.env - $PWD/backend-env:/root/okiba-org-backend/.env
- $PWD/frontend-env:/root/okiba-org-frontend/.env.local
- $PWD/logs/npm:/root/.npm/_logs/ - $PWD/logs/npm:/root/.npm/_logs/
- $PWD/logs/nginx:/var/log/nginx/
- $PWD/data/:/root/okiba-org-backend/data - $PWD/data/:/root/okiba-org-backend/data
ports: ports:
- 3000:3000 - 3000:80
- 8080:8080 - 8080:8080
restart: always restart: always
######################### #########################
@ -34,10 +34,10 @@ services:
- Make a new file called `backend-env` and configure it for backend process, here is a sample file: - Make a new file called `backend-env` and configure it for backend process, here is a sample file:
```env ```env
PORT = 8080 PORT = 8080
PGUSER = okiba PGHOST = okiba-db
PGHOST = okiba
PGDATABASE = okiba
PGPORT = 5432 PGPORT = 5432
PGUSER = okiba
PGDATABASE = okiba
PGPASSWORD = okiba PGPASSWORD = okiba
``` ```
- Make a new file called `frontend-env` and configure it for frontend process, here is a sample file: - Make a new file called `frontend-env` and configure it for frontend process, here is a sample file:

1
buildfiles/frontend-env Normal file
View File

@ -0,0 +1 @@
VITE_SERVER_URL=https://okiba.alk.pw

View File

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

View File

@ -1,11 +1,5 @@
services: services:
######################### #########################
okiba-org: okiba:
build: . build: .
hostname: okiba-org image: git.shihaam.dev/dockerfiles/okiba
image: git.shihaam.dev/dockerfiles/okiba-org-docker
volumes:
- $PWD/logs/npm:/root/.npm/_logs/
# ports:
# - 1111:80
restart: always