Spaces:
Runtime error
Runtime error
chore: splitting up repositories
Browse files- .dockerignore +1 -0
- Compose.yaml +7 -0
- Dockerfile +24 -0
- Dockerfile-Base +14 -0
- Dockerfile-Light +20 -0
- LICENSE.md +21 -0
- entrypoint.sh +7 -0
- railway.json +13 -0
.dockerignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# ignore memory folder
|
Compose.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '3.8'
|
2 |
+
|
3 |
+
services:
|
4 |
+
application:
|
5 |
+
build: .
|
6 |
+
ports:
|
7 |
+
- "80:80"
|
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Standard Dockerfile to build image of the webapp
|
2 |
+
|
3 |
+
## complete build based on clean python (slower)
|
4 |
+
FROM python:3.11.6
|
5 |
+
|
6 |
+
## build based on python with dependencies (quicker)
|
7 |
+
# FROM thesis:0.1.6-base
|
8 |
+
|
9 |
+
WORKDIR /webapp
|
10 |
+
|
11 |
+
# install dependencies and copy files
|
12 |
+
COPY /webapp/requirements.txt ./
|
13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
+
RUN pip install fastapi uvicorn
|
15 |
+
COPY /webapp/ ./
|
16 |
+
|
17 |
+
RUN ls --recursive ./
|
18 |
+
|
19 |
+
# setting config and run command
|
20 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
|
21 |
+
|
22 |
+
# build and run commands
|
23 |
+
## docker build -t thesis:0.1.6 -f Dockerfile-Light .
|
24 |
+
## docker run -d --name thesis -p 80:80 thesis:0.1.6-small
|
Dockerfile-Base
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Dockerfile to create base image with all needed dependencies
|
2 |
+
|
3 |
+
# using newest python as a base image
|
4 |
+
FROM python:3.11.6
|
5 |
+
|
6 |
+
# setting workdir
|
7 |
+
WORKDIR ./
|
8 |
+
|
9 |
+
# install dependencies based on requirements
|
10 |
+
COPY /webapp/requirements.txt ./
|
11 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
12 |
+
|
13 |
+
# build and run commands
|
14 |
+
## docker build -t thesis:0.1.6-base -f Dockerfile-Base .
|
Dockerfile-Light
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Light Dockerfile with not ready built dependencies (1GB vs. 7-8 GB)
|
2 |
+
|
3 |
+
## newest python version as base image
|
4 |
+
FROM python:3.11.6
|
5 |
+
|
6 |
+
#set working directory and copying files, endpoint script
|
7 |
+
WORKDIR /webapp
|
8 |
+
COPY /webapp/ ./
|
9 |
+
COPY /entrypoint.sh ./
|
10 |
+
|
11 |
+
# show files in directory
|
12 |
+
RUN ls --recursive ./
|
13 |
+
|
14 |
+
# setting config and run command
|
15 |
+
RUN chmod +x ./entrypoint.sh
|
16 |
+
ENTRYPOINT [ "/webapp/entrypoint.sh" ]
|
17 |
+
|
18 |
+
# build and run commands
|
19 |
+
## docker build -t thesis:0.1.6-small -f Dockerfile-Light .
|
20 |
+
## docker run -d --name thesis -p 80:80 thesis:0.1.6-small
|
LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2023 Lennard Zündorf
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
entrypoint.sh
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# installing all the dependencies
|
4 |
+
pip install --no-cache-dir --upgrade -r requirements.txt
|
5 |
+
|
6 |
+
# running the fastapi app
|
7 |
+
uvicorn main:app --host 0.0.0.0 --port 80
|
railway.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"$schema": "https://railway.app/railway.schema.json",
|
3 |
+
"build": {
|
4 |
+
"builder": "DOCKERFILE",
|
5 |
+
"dockerfilePath": "Dockerfile-Light"
|
6 |
+
},
|
7 |
+
"deploy": {
|
8 |
+
"numReplicas": 1,
|
9 |
+
"sleepApplication": false,
|
10 |
+
"restartPolicyType": "ON_FAILURE",
|
11 |
+
"restartPolicyMaxRetries": 10
|
12 |
+
}
|
13 |
+
}
|