-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create docker compose with nginx, node and mysql configured
- Loading branch information
0 parents
commit 5b557e6
Showing
7 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE TABLE IF NOT EXISTS people ( | ||
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, | ||
name VARCHAR(100) NOT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
|
||
#access_log /var/log/nginx/host.access.log main; | ||
|
||
location / { | ||
proxy_pass http://fullcycle-node:3000; | ||
} | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | ||
# | ||
#location ~ \.php$ { | ||
# proxy_pass http://127.0.0.1; | ||
#} | ||
|
||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||
# | ||
#location ~ \.php$ { | ||
# root html; | ||
# fastcgi_pass 127.0.0.1:9000; | ||
# fastcgi_index index.php; | ||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | ||
# include fastcgi_params; | ||
#} | ||
|
||
# deny access to .htaccess files, if Apache's document root | ||
# concurs with nginx's one | ||
# | ||
#location ~ /\.ht { | ||
# deny all; | ||
#} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
version: '3.8' | ||
|
||
services: | ||
node: | ||
image: node:20-alpine | ||
container_name: fullcycle-node | ||
command: npm run start | ||
volumes: | ||
- .:/app | ||
working_dir: /app | ||
expose: | ||
- "3000" | ||
depends_on: | ||
- db | ||
|
||
nginx: | ||
image: nginx:1.25.3-alpine | ||
container_name: fullcycle-nginx | ||
ports: | ||
- "8080:80" | ||
expose: | ||
- "80" | ||
volumes: | ||
- ./default.conf:/etc/nginx/conf.d/default.conf | ||
depends_on: | ||
- node | ||
|
||
db: | ||
image: mysql:8.3 | ||
container_name: fullcycle-mysql | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- ./.mysql:/var/lib/mysql | ||
- bootstrap.sql:/docker-entrypoint-initdb.d/1.sql | ||
environment: | ||
MYSQL_USER: "root" | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | ||
MYSQL_DATABASE: fullcycle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const http = require("node:http"); | ||
|
||
const hostname = "0.0.0.0"; | ||
const port = 3000; | ||
|
||
const server = http.createServer((req, res) => { | ||
res.statusCode = 200; | ||
res.setHeader("Content-Type", "text/plain"); | ||
res.end("<h1>Fullcycle Rocks!</h1>"); | ||
}); | ||
|
||
server.listen(port, hostname, () => { | ||
console.log(`Server running at http://${hostname}:${port}/`); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "desafio-proxy-fullcycle", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/diegosurita/desafio-proxy-fullcycle.git" | ||
}, | ||
"author": "Diego Surita <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/diegosurita/desafio-proxy-fullcycle/issues" | ||
}, | ||
"homepage": "https://github.com/diegosurita/desafio-proxy-fullcycle#readme" | ||
} |