This repository was archived by the owner on Dec 25, 2024. It is now read-only.
File tree 2 files changed +51
-1
lines changed
2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,11 @@ RUN chmod -R a-w /usr/local/lib/python3.8 && \
28
28
# Switch to non-root user
29
29
USER appuser
30
30
31
+ # Expose port 5000
32
+ EXPOSE 5000
33
+
31
34
# Run the application
32
- CMD ["python " , "pastebin.py " ]
35
+ CMD ["flask " , "run" , "--host=0.0.0.0 " ]
33
36
34
37
# Note: This Dockerfile implements several security measures.
35
38
# For full details on security practices, please refer to SECURITY.md
Original file line number Diff line number Diff line change
1
+ version : ' 3.8' # Specify the Docker Compose version
2
+
3
+ services :
4
+ pastebin :
5
+ user : appuser # Rule 2. Run as a non-root user
6
+ build :
7
+ context : .
8
+ dockerfile : Dockerfile
9
+ env_file :
10
+ - .env_file
11
+ ports :
12
+ - " 5000:5000"
13
+ volumes :
14
+ - .:/app:ro # Mount the current directory to /app in the container as read-only
15
+ restart : unless-stopped
16
+
17
+ # Rule 7. Resource Limits
18
+ deploy :
19
+ resources :
20
+ limits :
21
+ cpus : " 0.5" # Limit container to 50% of a CPU
22
+ memory : " 512M" # Limit container memory to 512MB
23
+
24
+ # Rule 8. Read-Only Filesystem
25
+ read_only : true # Mount the container's filesystem as read-only
26
+
27
+ # Rule 3. Drop All Capabilities
28
+ cap_drop :
29
+ - ALL
30
+
31
+ # Rule 4. Prevent the container from gaining new privileges
32
+ security_opt :
33
+ - no-new-privileges:true
34
+
35
+
36
+ # 8. Logging Configuration
37
+ logging :
38
+ driver : " json-file"
39
+ options :
40
+ max-size : " 10m"
41
+ max-file : " 3"
42
+
43
+
44
+ # Network Configuration
45
+ networks :
46
+ pastebin_network :
47
+ driver : bridge
You can’t perform that action at this time.
0 commit comments