BLD adding previous projects
This commit is contained in:
parent
be06da2d92
commit
b9bdfae5dd
15
DockerFirstSteps/C_App/Dockerfile
Normal file
15
DockerFirstSteps/C_App/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# use alpine as base image
|
||||||
|
FROM alpine AS build-env
|
||||||
|
# install build-base meta package inside build-env container
|
||||||
|
RUN apk add --no-cache build-base
|
||||||
|
# change directory to /app
|
||||||
|
WORKDIR /app
|
||||||
|
# copy all files from current directory inside the build-env container
|
||||||
|
COPY . .
|
||||||
|
# Compile the source code and generate hello binary executable file
|
||||||
|
RUN gcc -o hello helloDocker.c
|
||||||
|
# Set the executable file name as an environment variable
|
||||||
|
ENV PROGRAM_NAME=hello
|
||||||
|
# run the program using the environment variable
|
||||||
|
ENTRYPOINT ["sh", "-c", "/app/$PROGRAM_NAME"]
|
||||||
|
|
7
DockerFirstSteps/C_App/helloDocker.c
Normal file
7
DockerFirstSteps/C_App/helloDocker.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("Hello from our first Docker container\n");
|
||||||
|
return 0;
|
||||||
|
}
|
19
DockerFirstSteps/Python_App/Dockerfile
Normal file
19
DockerFirstSteps/Python_App/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# start by pulling the python image
|
||||||
|
FROM python:3.13-alpine
|
||||||
|
|
||||||
|
# copy the requirements file into the image
|
||||||
|
COPY ./requirements.txt /app/requirements.txt
|
||||||
|
|
||||||
|
# switch working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# install the dependencies and packages in the requirements file
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
# copy every content from the local file to the image
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
# configure the container to run in an executed manner
|
||||||
|
ENTRYPOINT [ "python" ]
|
||||||
|
|
||||||
|
CMD ["app.py" ]
|
17
DockerFirstSteps/Python_App/app.py
Normal file
17
DockerFirstSteps/Python_App/app.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from flask import Flask
|
||||||
|
import os
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
return 'Server Works!\n'
|
||||||
|
|
||||||
|
@app.route('/greet')
|
||||||
|
def say_hello():
|
||||||
|
return 'Hello from Server'
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
port = int(os.environ.get('PORT', 5000))
|
||||||
|
app.run(debug=True, host='0.0.0.0', port=port)
|
7
DockerFirstSteps/Python_App/requirements.txt
Normal file
7
DockerFirstSteps/Python_App/requirements.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
blinker==1.7.0
|
||||||
|
click==8.1.7
|
||||||
|
Flask==3.0.2
|
||||||
|
itsdangerous==2.1.2
|
||||||
|
Jinja2==3.1.3
|
||||||
|
MarkupSafe==2.1.5
|
||||||
|
Werkzeug==3.0.1
|
Loading…
x
Reference in New Issue
Block a user