Skip to content

Commit

Permalink
Dockerizing nothing private
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Sep 11, 2019
1 parent f5bd46c commit 8079289
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
.idea
*.DS_Store
cypress/videos/
cypress/screenshots/
cypress/screenshots/
docker/data
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]: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:

Expand Down
27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:
9 changes: 9 additions & 0 deletions docker/docker-connection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
set_exception_handler(function ($e) {
die('Error occurred!');
});

$mysqli = new mysqli('database', 'safeuser', 'safeuser', 'safedb');
$mysqli->set_charset('utf8mb4');
2 changes: 2 additions & 0 deletions docker/make_docker.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8079289

Please sign in to comment.