Spaces:
Sleeping
Sleeping
Docker Setup
Browse files- .dockerignore +27 -0
- .vscode/launch.json +19 -0
- .vscode/tasks.json +26 -0
- Dockerfile +24 -0
- docker-compose.debug.yml +11 -0
- docker-compose.yml +8 -0
- hello.py +2 -0
- requirements.txt +1 -0
.dockerignore
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
**/__pycache__
|
2 |
+
**/.venv
|
3 |
+
**/.classpath
|
4 |
+
**/.dockerignore
|
5 |
+
**/.env
|
6 |
+
**/.git
|
7 |
+
**/.gitignore
|
8 |
+
**/.project
|
9 |
+
**/.settings
|
10 |
+
**/.toolstarget
|
11 |
+
**/.vs
|
12 |
+
**/.vscode
|
13 |
+
**/*.*proj.user
|
14 |
+
**/*.dbmdl
|
15 |
+
**/*.jfm
|
16 |
+
**/bin
|
17 |
+
**/charts
|
18 |
+
**/docker-compose*
|
19 |
+
**/compose*
|
20 |
+
**/Dockerfile*
|
21 |
+
**/node_modules
|
22 |
+
**/npm-debug.log
|
23 |
+
**/obj
|
24 |
+
**/secrets.dev.yaml
|
25 |
+
**/values.dev.yaml
|
26 |
+
LICENSE
|
27 |
+
README.md
|
.vscode/launch.json
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"configurations": [
|
3 |
+
{
|
4 |
+
"name": "Docker: Python - General",
|
5 |
+
"type": "docker",
|
6 |
+
"request": "launch",
|
7 |
+
"preLaunchTask": "docker-run: debug",
|
8 |
+
"python": {
|
9 |
+
"pathMappings": [
|
10 |
+
{
|
11 |
+
"localRoot": "${workspaceFolder}",
|
12 |
+
"remoteRoot": "/app"
|
13 |
+
}
|
14 |
+
],
|
15 |
+
"projectType": "general"
|
16 |
+
}
|
17 |
+
}
|
18 |
+
]
|
19 |
+
}
|
.vscode/tasks.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": "2.0.0",
|
3 |
+
"tasks": [
|
4 |
+
{
|
5 |
+
"type": "docker-build",
|
6 |
+
"label": "docker-build",
|
7 |
+
"platform": "python",
|
8 |
+
"dockerBuild": {
|
9 |
+
"tag": "cs482project:latest",
|
10 |
+
"dockerfile": "${workspaceFolder}/Dockerfile",
|
11 |
+
"context": "${workspaceFolder}",
|
12 |
+
"pull": true
|
13 |
+
}
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"type": "docker-run",
|
17 |
+
"label": "docker-run: debug",
|
18 |
+
"dependsOn": [
|
19 |
+
"docker-build"
|
20 |
+
],
|
21 |
+
"python": {
|
22 |
+
"file": "hello.py"
|
23 |
+
}
|
24 |
+
}
|
25 |
+
]
|
26 |
+
}
|
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# For more information, please refer to https://aka.ms/vscode-docker-python
|
2 |
+
FROM python:3.10-slim
|
3 |
+
|
4 |
+
EXPOSE 1024
|
5 |
+
# Keeps Python from generating .pyc files in the container
|
6 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
7 |
+
|
8 |
+
# Turns off buffering for easier container logging
|
9 |
+
ENV PYTHONUNBUFFERED=1
|
10 |
+
|
11 |
+
# Install pip requirements
|
12 |
+
COPY requirements.txt .
|
13 |
+
RUN python -m pip install -r requirements.txt
|
14 |
+
|
15 |
+
WORKDIR /app
|
16 |
+
COPY . /app
|
17 |
+
|
18 |
+
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
|
19 |
+
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
|
20 |
+
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
21 |
+
USER appuser
|
22 |
+
|
23 |
+
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
|
24 |
+
CMD ["python", "hello.py"]
|
docker-compose.debug.yml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '3.4'
|
2 |
+
|
3 |
+
services:
|
4 |
+
cs482project:
|
5 |
+
image: cs482project
|
6 |
+
build:
|
7 |
+
context: .
|
8 |
+
dockerfile: ./Dockerfile
|
9 |
+
command: ["sh", "-c", "pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 hello.py "]
|
10 |
+
ports:
|
11 |
+
- 5678:5678
|
docker-compose.yml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '3.4'
|
2 |
+
|
3 |
+
services:
|
4 |
+
cs482project:
|
5 |
+
image: cs482project
|
6 |
+
build:
|
7 |
+
context: .
|
8 |
+
dockerfile: ./Dockerfile
|
hello.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
#hello world
|
2 |
+
print("Hello World")
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# To ensure app dependencies are ported from your virtual environment/host machine into your container, run 'pip freeze > requirements.txt' in the terminal to overwrite this file
|