Compare commits

..

19 Commits

Author SHA1 Message Date
6e4b115b89 node is gay, alok is gay for using node 2022-12-20 23:58:16 +05:00
9dceb03d49 change mount path for frontend env and enabled nginx logs 2022-12-20 23:48:05 +05:00
7e39c53290 changed to nginx port 2022-12-20 23:21:53 +05:00
b3a909cebe easier manager layers, frontend with nginx 2022-12-20 23:14:02 +05:00
02c85fce39 updated readme docker-compose 2022-12-14 01:02:43 +05:00
a8113504f8 updated build docker-compose 2022-12-14 01:02:15 +05:00
485a744478 fix readme 2022-12-14 00:56:21 +05:00
c42fcc8ea6 that was..stupid, removed env.local from build 2022-12-14 00:49:04 +05:00
2ec443939f readme update 2022-12-14 00:48:19 +05:00
d8aeea64ff connect front and back 2022-12-14 00:34:41 +05:00
37dc6c6765 bruhhh... no need to expose backend lolll 2022-12-14 00:33:08 +05:00
81d5ea586a no need for full path since i source profile and bashrc first 2022-12-14 00:22:52 +05:00
c41046416e expose port 3030 2022-12-14 00:22:12 +05:00
1c3c6e426f source profile and bashrc before starting service 2022-12-14 00:19:55 +05:00
a361262b45 added full path to /root/.local/share/pnpm/pnpm 2022-12-14 00:15:23 +05:00
fb065186d6 added open port 8080 2022-12-14 00:12:57 +05:00
7bd1f5dbb7 swapped back and front 2022-12-14 00:09:07 +05:00
8a8c1de1e6 updated gitgnore, added db 2022-12-13 23:56:49 +05:00
9b59b8ea01 updated readme 2022-12-13 23:56:27 +05:00
6 changed files with 79 additions and 17 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
public/
test/
data/
.env
db/

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 .

47
README.md Normal file
View File

@@ -0,0 +1,47 @@
## Okiba Docker
# Getting started
- save the follwing content as `docker-compose.yml`
```yml
services:
#########################
okiba:
hostname: okiba
image: git.shihaam.dev/dockerfiles/okiba
volumes:
- $PWD/backend-env:/root/okiba-org-backend/.env
- $PWD/logs/npm:/root/.npm/_logs/
- $PWD/logs/nginx:/var/log/nginx/
- $PWD/data/:/root/okiba-org-backend/data
ports:
- 3000:80
- 8080:8080
restart: always
#########################
postgres:
hostname: okiba-db
image: postgres:13-alpine
volumes:
- $PWD/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=okiba
- POSTGRES_USER=okiba
- POSTGRES_PASSWORD=okiba
restart: unless-stopped
```
- Make a new file called `backend-env` and configure it for backend process, here is a sample file:
```env
PORT = 8080
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:
```env
VITE_SERVER_URL=http://localhost:8080
```
- Run `docker compose up`

1
buildfiles/frontend-env Normal file
View File

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

View File

@@ -1,10 +1,12 @@
#!/bin/bash
#Start backend
cd /root/okiba-org-frontend; pnpm start &
source $HOME/.profile; source $HOME/.bashrc
#Start frontend
cd /root/okiba-org-backend; pnpm run dev &
/usr/sbin/nginx -g 'daemon off; master_process on;' &
#Start backend
cd /root/okiba-org-backend; pnpm start &
# Wait for any process to exit
wait -n

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