adaugat lab4 si lab5

Signed-off-by: hellisabove <robertnedela15@gmail.com>
This commit is contained in:
hellisabove
2026-05-25 11:13:40 +03:00
parent 8b7c9a5527
commit 35893a4012
78 changed files with 60025 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
FROM alpine:edge
RUN apk add --update py3-pip
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"
COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt
COPY app.py /usr/src/app/
COPY templates/index.html /usr/src/app/templates/
EXPOSE 5000
CMD ["python3", "/usr/src/app/app.py"]
+19
View File
@@ -0,0 +1,19 @@
from flask import Flask, render_template
import random
app = Flask(__name__)
images = [
"https://i.pinimg.com/736x/8f/2a/30/8f2a30993c405b083ba8820ae6803b93.jpg",
"https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_1528237089/microsoft-azure-biztalk-services.jpg",
"https://aptira.com/wp-content/uploads/2016/09/kubernetes_logo.png",
"https://www.opsview.com/sites/default/files/docker.png"
]
@app.route('/')
def index():
url = random.choice(images)
return render_template('index.html', url=url)
if __name__ == "__main__":
app.run(host="0.0.0.0")
+1
View File
@@ -0,0 +1 @@
Flask>=2.2.2
+27
View File
@@ -0,0 +1,27 @@
<html>
<head>
<style type="text/css">
body {
background: black;
color: white;
}
div.container {
max-width: 500px;
margin: 100px auto;
border: 20px solid white;
padding: 10px;
text-align: center;
}
h4 {
text-transform: uppercase;
}
</style>
</head>
<body>
<div class="container">
<h4>Cloud image of the day</h4>
<img src="{{url}}" />
</div>
</body>
</html>
+10
View File
@@ -0,0 +1,10 @@
FROM node:21-alpine3.18
COPY package.json /
RUN npm install
COPY server.js /usr/src/app/
EXPOSE 8080
CMD ["node", "/usr/src/app/server.js"]
+12
View File
@@ -0,0 +1,12 @@
{
"name": "docker_web_app",
"version": "1.0.0",
"description": "Node.js on Docker",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.16.1"
}
}
+14
View File
@@ -0,0 +1,14 @@
'use strict';
const express = require('express');
const PORT = 8080;
const HOST = '0.0.0.0';
const app = express();
app.get('/', (req, res) => {
res.send('Hello World');
});
app.listen(PORT, HOST);
console.log(`Running on http://${HOST}:${PORT}`);