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 \
&& 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
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 .

View File

@ -8,14 +8,14 @@ services:
#########################
okiba:
hostname: okiba
image: git.shihaam.dev/dockerfiles/okiba-org-docker
image: git.shihaam.dev/dockerfiles/okiba
volumes:
- $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/nginx:/var/log/nginx/
- $PWD/data/:/root/okiba-org-backend/data
ports:
- 3000:3000
- 3000:80
- 8080:8080
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:
```env
PORT = 8080
PGUSER = okiba
PGHOST = okiba
PGDATABASE = okiba
PGHOST = okiba-db
PGPORT = 5432
PGUSER = okiba
PGDATABASE = okiba
PGPASSWORD = okiba
```
- 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
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 &

View File

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