Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Mar 6, 2024
1 parent b35a40a commit c179ec9
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:10-alpine

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app

WORKDIR /home/node/app

COPY package*.json ./

USER node

RUN npm install

COPY --chown=node:node . .

EXPOSE 8080

CMD [ "node", "app.js" ]
12 changes: 11 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ router.get('/sharks', function(req,res){
});

router.get('/sharkslists', function(req,res){
res.sendFile(path + 'sharkslists.html');
//res.sendFile(path + 'sharkslists.html');
var query = "SELECT * FROM lists";
connection.query(query, function(error, data){
if(error){
console.log(error)
}
else{
console.log(data)
res.json(data)
}
});
});

app.use(express.static(path));
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3.0"
services:
db:
container_name: mysql
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: Netpoleon#1
MYSQL_DATABASE: sharkslist
ports:
- '3306:3306'
volumes:
- sharkwow-mysql-data:/var/lib/mysql
app:
container_name: nodejsappgod
image: rurouniken89/nodejsappgod:latest
build:
context: .
dockerfile: Dockerfile
deploy:
restart_policy:
condition: unless-stopped
depends_on:
- db
ports:
- 2681:8080
volumes:
sharkwow-mysql-data:
driver: local

10 changes: 10 additions & 0 deletions views/sharkslists.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,15 @@
<div class="jumbotron text-center">
<h1>Shark Info</h1>
</div>
<div class="container">
<div class="row">
<div class="col-lg-6">
<p>
<div class="caption">Some sharks are known to be dangerous to humans, though many more are not. The sawshark, for example, is not considered a threat to humans.
</div>
</p>
</div>
</div>
</div>

</html>

0 comments on commit c179ec9

Please sign in to comment.