diff --git a/.gitignore b/.gitignore index c637d9e..b32d20f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules .idea *.DS_Store cypress/videos/ -cypress/screenshots/ \ No newline at end of file +cypress/screenshots/ +docker/data diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5634e92 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM php:7.3-apache +COPY . /var/www/html/ +RUN docker-php-ext-install mysqli +RUN bash /var/www/html/docker/make_docker.sh diff --git a/README.md b/README.md index 65b24c1..1db3a3f 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,17 @@ Feel free to modify the code and open any pull requests. * [ ] Add more links * [ ] Fix any typos +## Running locally + +You can run nothing private locally via docker using the commands below: +```bash +git clone git@github.com:gautamkrishnar/nothing-private.git +cd nothing-private +docker-compose up -d # use --build to update image if you do 'git pull' +``` + +Visit http://localhost/ + ## Contributors Special thanks to these rockstars: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8cf4473 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: "3.1" +services: + app: + build: . + ports: + - "80:80" + restart: always + networks: + - default + database: + image: mysql:8.0 + command: --default-authentication-plugin=mysql_native_password + expose: + - '3306' + environment: + MYSQL_DATABASE: safedb + MYSQL_USER: safeuser + MYSQL_PASSWORD: safeuser + MYSQL_ROOT_PASSWORD: safeuser + restart: always + volumes: + - ./db_server:/docker-entrypoint-initdb.d + - ./docker/data:/var/lib/mysql + networks: + - default +networks: + default: diff --git a/docker/docker-connection.php b/docker/docker-connection.php new file mode 100644 index 0000000..c6eb49e --- /dev/null +++ b/docker/docker-connection.php @@ -0,0 +1,9 @@ +set_charset('utf8mb4'); diff --git a/docker/make_docker.sh b/docker/make_docker.sh new file mode 100644 index 0000000..9388d71 --- /dev/null +++ b/docker/make_docker.sh @@ -0,0 +1,2 @@ +sed -i 's/window.location.protocol + \"\/\/nothingprivate.000webhostapp.com\"/document.location.href + \"\db_server\"/g' /var/www/html/main.js +cp -fv /var/www/html/docker/docker-connection.php /var/www/html/db_server/connection.php