Compare commits

...

14 Commits

Author SHA1 Message Date
8d6ef37d52 push final pentru astazi 2025-12-12 09:36:20 +00:00
85b8c1cdb5 Ce nu am inteles 2025-12-12 09:08:50 +00:00
c7516cfd6e Ce nu am inteles 2025-12-12 09:07:52 +00:00
3525523167 Servicii pe docker cu diverse aplicatii: python, node, php, .net 2025-12-12 09:00:05 +00:00
498b01ddd1 Primul container docker ce ruleaza un php simplu si un phpinfo in src (proiect) 2025-12-12 07:52:21 +00:00
86e34d222a Script php 2025-12-12 06:35:03 +00:00
94b85461b3 Push 4 2025-12-12 06:28:40 +00:00
e908f27839 Push 3 2025-12-12 06:22:48 +00:00
cc4b5a4cbf Push2 2025-12-12 06:00:10 +00:00
e9cfd671ac Push 2025-12-12 05:43:38 +00:00
096a4470c3 Python 2025-12-12 01:27:48 +00:00
9178cd7a63 Bandit passwords 2025-12-12 00:59:17 +00:00
e1de57ecf2 Merge pull request 'Seeend' (#2) from dev into main
Reviewed-on: #2
2025-12-12 00:44:12 +00:00
7af312e960 Seeend 2025-12-12 00:43:37 +00:00
46 changed files with 560 additions and 3 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
/vendor
/node_modules
.env
.DS_Store

View File

@@ -1,3 +1,22 @@
# alexr_teste
### Alex's itschool place
Teste
**Teste**
- element
- element
- sub-element
* element
1. Primul
2. Al doilea
3. Al treilea
[Text link](https://example.com)
![Alt text](https://example.com/imagine.png)
Folosesc `npm run dev`

5
bandit_passwords.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo "Level 0 pw: ZjLjTmM6FvvyRnrb2rfNWOZOTa6ip5If"
echo "Level 1 pw: 263JGJPfgU6LtdEvgfWU1XP5yac29mFx"
echo "Level 2 pw: MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx"

53
docker-compose.yml Normal file
View File

@@ -0,0 +1,53 @@
services:
nginx:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./www/app_php:/var/www/src
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
restart: unless-stopped
php:
image: php:8.3-fpm
volumes:
- ./www/app_php:/var/www/src
restart: unless-stopped
python:
image: python:3.12-slim
container_name: alex-python
working_dir: /app
volumes:
- .:/app
command: python /app/www/script_python2.py
ports:
- "8088:8088"
restart: unless-stopped
dotnet:
image: mcr.microsoft.com/dotnet/sdk:8.0
container_name: alex-dotnet
working_dir: /app
volumes:
- ./www/programDotNet:/app
command: dotnet run --urls http://0.0.0.0:8085
ports:
- "8085:8085"
restart: unless-stopped
node:
image: node:20-alpine
container_name: alex-node
working_dir: /app
volumes:
- .:/app
environment:
- PORT=8090
command: node /app/www/node_script.js
ports:
- "8090:8090"
restart: unless-stopped

5
docker/dotnet/Docker Normal file
View File

@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY . .
EXPOSE 8088
ENTRYPOINT ["dotnet", "SimpleDotnetServer.dll"]

22
docker/nginx/default.conf Normal file
View File

@@ -0,0 +1,22 @@
server {
listen 80;
server_name localhost;
root /var/www/src;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}

10
docker/php/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM php:8.4-apache
RUN apt-get update && apt-get install -y \
git \
unzip \
nano \
&& docker-php-ext-install pdo pdo_mysql \
&& a2enmod rewrite
WORKDIR /var/www/html

View File

@@ -76,3 +76,6 @@ salut "Alex"
echo "O modificare pe branch-ul dev"
echo "Altă modificare pe branch-ul dev"
echo "Pushuit cu cheie ssh fara user si parola"

1
script.log Normal file
View File

@@ -0,0 +1 @@
2025-12-12T06:34:25+00:00 | Daniel | amount=250 | vat=47.5 | total=297.5

45
script_php.php Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
/**
* Rulare:
* php script.php --name=Daniel --amount=125.50
*/
function usage(): void {
echo "Usage: php script.php --name=NAME --amount=NUMBER\n";
exit(1);
}
$options = getopt("", ["name:", "amount:"]);
$name = $options["name"] ?? null;
$amount = $options["amount"] ?? null;
if ($name === null || $amount === null) {
usage();
}
if (!is_numeric($amount)) {
fwrite(STDERR, "Error: --amount must be numeric.\n");
exit(1);
}
$amount = (float)$amount;
$vatRate = 0.19; // TVA 19%
$vat = round($amount * $vatRate, 2);
$total = round($amount + $vat, 2);
$result = [
"name" => $name,
"amount" => $amount,
"vat" => $vat,
"total" => $total,
"time" => date("c"),
];
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
// scrie și un log local
$logLine = $result["time"] . " | {$name} | amount={$amount} | vat={$vat} | total={$total}\n";
file_put_contents(__DIR__ . "/script.log", $logLine, FILE_APPEND);

17
script_python.py Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python3
import os
def main():
cwd = os.getcwd()
files = os.listdir(cwd)
print(f"Folder curent: {cwd}\n")
print("Fișiere găsite:")
for name in files:
print(f" - {name}")
print(f"\nTotal fișiere/foldere: {len(files)}")
if __name__ == "__main__":
main()

6
toBeDiscussed.md Normal file
View File

@@ -0,0 +1,6 @@
Nu am inteles urmatoarele:
-de ce nu am folder python in folderul docker?
-de ce/cum ruleaza pe imaginea din docker python
-in ce caz punem in folderul docker imaginile?
-te rog o explicatie asupra structurii docker, docker-compose.yml si src

3
www/app_php/index.php Normal file
View File

@@ -0,0 +1,3 @@
<?php
phpinfo();

12
www/node_script.js Normal file
View File

@@ -0,0 +1,12 @@
const http = require("http");
const PORT = process.env.PORT || 8090;
const server = http.createServer((req, res) => {
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
res.end("Salut! Node.js rulează pe portul " + PORT + "\n");
});
server.listen(PORT, "0.0.0.0", () => {
console.log(`Node server: http://0.0.0.0:${PORT}`);
});

View File

@@ -0,0 +1,10 @@
var builder = WebApplication.CreateBuilder(args);
// ascultă pe 0.0.0.0:8085
builder.WebHost.UseUrls("http://0.0.0.0:8085");
var app = builder.Build();
app.MapGet("/", () => "Salut! .NET rulează pe 8085. fisier updatat");
app.Run();

Binary file not shown.

View File

@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"programDotNet/1.0.0": {
"runtime": {
"programDotNet.dll": {}
}
}
}
},
"libraries": {
"programDotNet/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,19 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "8.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

Binary file not shown.

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("programDotNet")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("programDotNet")]
[assembly: System.Reflection.AssemblyTitleAttribute("programDotNet")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -0,0 +1 @@
ef4e0c11006f2dd239d8ab66d729a68f61d4fa32924b55c8329b555050161ab2

View File

@@ -0,0 +1,19 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = programDotNet
build_property.RootNamespace = programDotNet
build_property.ProjectDir = /app/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 8.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = /app
build_property._RazorSourceGeneratorDebug =

View File

@@ -0,0 +1,17 @@
// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@@ -0,0 +1 @@
e9330eaf0428b40e8599ac23a52ec780ad006a9006d294392fe6cc89c2049101

View File

@@ -0,0 +1,23 @@
/app/obj/Debug/net8.0/programDotNet.GeneratedMSBuildEditorConfig.editorconfig
/app/obj/Debug/net8.0/programDotNet.AssemblyInfoInputs.cache
/app/obj/Debug/net8.0/programDotNet.AssemblyInfo.cs
/app/obj/Debug/net8.0/programDotNet.csproj.CoreCompileInputs.cache
/app/obj/Debug/net8.0/programDotNet.MvcApplicationPartsAssemblyInfo.cache
/app/bin/Debug/net8.0/programDotNet
/app/bin/Debug/net8.0/programDotNet.deps.json
/app/bin/Debug/net8.0/programDotNet.runtimeconfig.json
/app/bin/Debug/net8.0/programDotNet.dll
/app/bin/Debug/net8.0/programDotNet.pdb
/app/obj/Debug/net8.0/staticwebassets.build.json
/app/obj/Debug/net8.0/staticwebassets.development.json
/app/obj/Debug/net8.0/scopedcss/bundle/programDotNet.styles.css
/app/obj/Debug/net8.0/programDotNet.dll
/app/obj/Debug/net8.0/refint/programDotNet.dll
/app/obj/Debug/net8.0/programDotNet.pdb
/app/obj/Debug/net8.0/programDotNet.genruntimeconfig.cache
/app/obj/Debug/net8.0/ref/programDotNet.dll
/app/obj/Debug/net8.0/staticwebassets/msbuild.programDotNet.Microsoft.AspNetCore.StaticWebAssets.props
/app/obj/Debug/net8.0/staticwebassets/msbuild.build.programDotNet.props
/app/obj/Debug/net8.0/staticwebassets/msbuild.buildMultiTargeting.programDotNet.props
/app/obj/Debug/net8.0/staticwebassets/msbuild.buildTransitive.programDotNet.props
/app/obj/Debug/net8.0/staticwebassets.pack.json

Binary file not shown.

View File

@@ -0,0 +1 @@
6c6db989a285f699deea041ae91957c98d32357a05190823d5ccb6d286e83fec

Binary file not shown.

View File

@@ -0,0 +1,11 @@
{
"Version": 1,
"Hash": "iKrrIYpJZohPz31GBVLhzn4bAYo7qnEuRFes2tPKNgE=",
"Source": "programDotNet",
"BasePath": "_content/programDotNet",
"Mode": "Default",
"ManifestType": "Build",
"ReferencedProjectsConfiguration": [],
"DiscoveryPatterns": [],
"Assets": []
}

View File

@@ -0,0 +1,3 @@
<Project>
<Import Project="Microsoft.AspNetCore.StaticWebAssets.props" />
</Project>

View File

@@ -0,0 +1,3 @@
<Project>
<Import Project="../build/programDotNet.props" />
</Project>

View File

@@ -0,0 +1,3 @@
<Project>
<Import Project="../buildMultiTargeting/programDotNet.props" />
</Project>

View File

@@ -0,0 +1,69 @@
{
"format": 1,
"restore": {
"/app/programDotNet.csproj": {}
},
"projects": {
"/app/programDotNet.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/app/programDotNet.csproj",
"projectName": "programDotNet",
"projectPath": "/app/programDotNet.csproj",
"packagesPath": "/root/.nuget/packages/",
"outputPath": "/app/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/root/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.AspNetCore.App": {
"privateAssets": "none"
},
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.416/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/root/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/root/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/root/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@@ -0,0 +1,74 @@
{
"version": 3,
"targets": {
"net8.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net8.0": []
},
"packageFolders": {
"/root/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/app/programDotNet.csproj",
"projectName": "programDotNet",
"projectPath": "/app/programDotNet.csproj",
"packagesPath": "/root/.nuget/packages/",
"outputPath": "/app/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/root/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.AspNetCore.App": {
"privateAssets": "none"
},
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.416/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "A0EP6Bndszc=",
"success": true,
"projectFilePath": "/app/programDotNet.csproj",
"expectedPackageFiles": [],
"logs": []
}

View File

@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

17
www/script_python2.py Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "text/plain; charset=utf-8")
self.end_headers()
self.wfile.write(b"Salut! Server Python 2 ruleaza pe portul 8088")
def main():
server = HTTPServer(("0.0.0.0", 8088), Handler)
print("Python server pornit pe http://0.0.0.0:8088")
server.serve_forever()
if __name__ == "__main__":
main()