docksec 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docksec-0.1.0/.env.example +1 -0
- docksec-0.1.0/LICENSE +201 -0
- docksec-0.1.0/MANIFEST.in +6 -0
- docksec-0.1.0/PKG-INFO +25 -0
- docksec-0.1.0/README.md +127 -0
- docksec-0.1.0/docksec.egg-info/PKG-INFO +25 -0
- docksec-0.1.0/docksec.egg-info/SOURCES.txt +16 -0
- docksec-0.1.0/docksec.egg-info/dependency_links.txt +1 -0
- docksec-0.1.0/docksec.egg-info/entry_points.txt +2 -0
- docksec-0.1.0/docksec.egg-info/requires.txt +9 -0
- docksec-0.1.0/docksec.egg-info/top_level.txt +1 -0
- docksec-0.1.0/docksec.py +51 -0
- docksec-0.1.0/pyproject.toml +12 -0
- docksec-0.1.0/requirements.txt +11 -0
- docksec-0.1.0/setup.cfg +4 -0
- docksec-0.1.0/setup.py +32 -0
- docksec-0.1.0/testfiles/1/Dockerfile +138 -0
- docksec-0.1.0/testfiles/2/Dockerfile +176 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
OPENAI_API_KEY= ""
|
docksec-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
docksec-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docksec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Docker security analysis tool
|
|
5
|
+
Author: Advait Patel
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/advaitpatel/DockSec/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/advaitpatel/DockSec/blob/main/README.md
|
|
8
|
+
Project-URL: Source Code, https://github.com/advaitpatel/DockSec
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: langchain
|
|
12
|
+
Requires-Dist: langchain-openai
|
|
13
|
+
Requires-Dist: python-dotenv
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: tqdm
|
|
16
|
+
Requires-Dist: colorama
|
|
17
|
+
Requires-Dist: rich
|
|
18
|
+
Requires-Dist: fpdf
|
|
19
|
+
Requires-Dist: setuptools
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: project-url
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: requires-python
|
|
25
|
+
Dynamic: summary
|
docksec-0.1.0/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# DockSec - AI-Powered Docker Security Analyzer
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
DockSec is an open-source AI-powered tool designed to analyze Dockerfiles for security vulnerabilities, misconfigurations, and inefficiencies. It provides automated recommendations to enhance container security, reduce the attack surface, and improve compliance with industry best practices.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
- AI/ML-Powered Analysis: Uses AI models to detect vulnerabilities and suggest security improvements.
|
|
8
|
+
- Security Vulnerability Detection: Scans Dockerfiles for known security issues, CVEs, and misconfigurations.
|
|
9
|
+
- Best Practice Recommendations: Provides actionable insights to enhance security, minimize image size, and improve efficiency.
|
|
10
|
+
- Integration with Development Tools:
|
|
11
|
+
- VS Code extension for inline security suggestions.
|
|
12
|
+
- CI/CD pipeline support (GitHub Actions, GitLab CI, Jenkins).
|
|
13
|
+
- Compliance Checks: Aligns with CIS Benchmarks, Docker Security Best Practices, and OWASP guidelines.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Create a virtual environment
|
|
19
|
+
```bash
|
|
20
|
+
python -m venv env
|
|
21
|
+
```
|
|
22
|
+
Activate the environment
|
|
23
|
+
```bash
|
|
24
|
+
env\Scripts\activate # for mac use "source env\bin\activate"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Install the tool using pip:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This will install the `docksec` command-line tool.
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
The following dependencies will be automatically installed:
|
|
38
|
+
- langchain
|
|
39
|
+
- langchain-openai
|
|
40
|
+
- python-dotenv
|
|
41
|
+
- pandas
|
|
42
|
+
- tqdm
|
|
43
|
+
- colorama
|
|
44
|
+
- rich
|
|
45
|
+
- fpdf
|
|
46
|
+
- setuptools
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### CLI Tool
|
|
51
|
+
|
|
52
|
+
After installation, you can use DockSec with a simple command:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
docksec path\to\Dockerfile
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Options:
|
|
59
|
+
- `-i, --image`: Specify Docker image ID for scanning (optional)
|
|
60
|
+
- `-o, --output`: Specify output file for the report (default: security_report.txt)
|
|
61
|
+
- `--ai-only`: Run only AI-based recommendations
|
|
62
|
+
- `--scan-only`: Run only Dockerfile/image scanning
|
|
63
|
+
|
|
64
|
+
### Examples:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Basic analysis
|
|
68
|
+
docksec path\to\Dockerfile
|
|
69
|
+
|
|
70
|
+
# Analyze both Dockerfile and a specific image
|
|
71
|
+
docksec path\to\Dockerfile -i myimage:latest
|
|
72
|
+
|
|
73
|
+
# Only run AI recommendations
|
|
74
|
+
docksec path\to\Dockerfile --ai-only
|
|
75
|
+
|
|
76
|
+
# Only scan for vulnerabilities with custom output file
|
|
77
|
+
docksec path\to\Dockerfile --scan-only -o custom_report.txt
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Legacy Usage
|
|
81
|
+
|
|
82
|
+
You can still use the original commands:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# For AI-based recommendations
|
|
86
|
+
python .\main.py "path\to\your\dockerfile"
|
|
87
|
+
|
|
88
|
+
# For scanning both Dockerfile and images
|
|
89
|
+
python docker_scanner.py <dockerfile_path> <image_name> [severity]
|
|
90
|
+
# Example: python docker_scanner.py .\Dockerfile myapp:latest CRITICAL,HIGH
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### External Tools Setup
|
|
94
|
+
|
|
95
|
+
To check the Dockerfile as well as images for vulnerabilities, you need to setup Trivy and hadolint:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python .\setup_external_tools.py
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
For manual installation, refer to [Trivy](https://trivy.dev/v0.18.3/installation/) and [hadolint](https://github.com/hadolint/hadolint?tab=readme-ov-file#install) documentation.
|
|
102
|
+
|
|
103
|
+
## CI/CD Integration
|
|
104
|
+
TBD
|
|
105
|
+
|
|
106
|
+
## Roadmap
|
|
107
|
+
TBD
|
|
108
|
+
|
|
109
|
+
## Contributing
|
|
110
|
+
We welcome contributions! To get started:
|
|
111
|
+
1. Fork the repository.
|
|
112
|
+
2. Create a new branch for your feature or fix.
|
|
113
|
+
3. Commit your changes and submit a pull request.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
117
|
+
|
|
118
|
+
## Get Involved
|
|
119
|
+
- ⭐ Star this repository to show support!
|
|
120
|
+
- 📢 Share your feedback via GitHub Issues.
|
|
121
|
+
- 📝 Write about DockSec and contribute to our documentation.
|
|
122
|
+
|
|
123
|
+
## Contact
|
|
124
|
+
For questions or collaborations, reach out via:
|
|
125
|
+
- GitHub Discussions: DockSec Community
|
|
126
|
+
- Twitter: @yourhandle
|
|
127
|
+
- LinkedIn: Your Profile
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docksec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Docker security analysis tool
|
|
5
|
+
Author: Advait Patel
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/advaitpatel/DockSec/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/advaitpatel/DockSec/blob/main/README.md
|
|
8
|
+
Project-URL: Source Code, https://github.com/advaitpatel/DockSec
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: langchain
|
|
12
|
+
Requires-Dist: langchain-openai
|
|
13
|
+
Requires-Dist: python-dotenv
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: tqdm
|
|
16
|
+
Requires-Dist: colorama
|
|
17
|
+
Requires-Dist: rich
|
|
18
|
+
Requires-Dist: fpdf
|
|
19
|
+
Requires-Dist: setuptools
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: project-url
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: requires-python
|
|
25
|
+
Dynamic: summary
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.env.example
|
|
2
|
+
LICENSE
|
|
3
|
+
MANIFEST.in
|
|
4
|
+
README.md
|
|
5
|
+
docksec.py
|
|
6
|
+
pyproject.toml
|
|
7
|
+
requirements.txt
|
|
8
|
+
setup.py
|
|
9
|
+
docksec.egg-info/PKG-INFO
|
|
10
|
+
docksec.egg-info/SOURCES.txt
|
|
11
|
+
docksec.egg-info/dependency_links.txt
|
|
12
|
+
docksec.egg-info/entry_points.txt
|
|
13
|
+
docksec.egg-info/requires.txt
|
|
14
|
+
docksec.egg-info/top_level.txt
|
|
15
|
+
testfiles/1/Dockerfile
|
|
16
|
+
testfiles/2/Dockerfile
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
docksec
|
docksec-0.1.0/docksec.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import os
|
|
5
|
+
import argparse
|
|
6
|
+
import subprocess
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
parser = argparse.ArgumentParser(description='Docker Security Analysis Tool')
|
|
10
|
+
parser.add_argument('dockerfile', help='Path to the Dockerfile to analyze')
|
|
11
|
+
parser.add_argument('-i', '--image', help='Docker image ID to scan (optional)')
|
|
12
|
+
parser.add_argument('-o', '--output', help='Output file for the report (default: security_report.txt)')
|
|
13
|
+
parser.add_argument('--ai-only', action='store_true', help='Run only AI-based recommendations')
|
|
14
|
+
parser.add_argument('--scan-only', action='store_true', help='Run only Dockerfile/image scanning')
|
|
15
|
+
|
|
16
|
+
args = parser.parse_args()
|
|
17
|
+
|
|
18
|
+
# Validate that the Dockerfile exists
|
|
19
|
+
if not os.path.isfile(args.dockerfile):
|
|
20
|
+
print(f"Error: Dockerfile not found at {args.dockerfile}")
|
|
21
|
+
sys.exit(1)
|
|
22
|
+
|
|
23
|
+
# Determine which tools to run
|
|
24
|
+
run_ai = not args.scan_only
|
|
25
|
+
run_scan = not args.ai_only
|
|
26
|
+
|
|
27
|
+
if not run_ai and not run_scan:
|
|
28
|
+
run_ai = run_scan = True # Run both by default
|
|
29
|
+
|
|
30
|
+
# Run the AI-based recommendation tool
|
|
31
|
+
if run_ai:
|
|
32
|
+
print("Running AI-based Dockerfile analysis...")
|
|
33
|
+
# Using list form to avoid shell parsing issues on Windows
|
|
34
|
+
subprocess.run([sys.executable, "main.py", args.dockerfile])
|
|
35
|
+
|
|
36
|
+
# Run the scanner tool
|
|
37
|
+
if run_scan:
|
|
38
|
+
print("Running Dockerfile and image scanner...")
|
|
39
|
+
output_file = args.output or "security_report.txt"
|
|
40
|
+
image_id = args.image or ""
|
|
41
|
+
|
|
42
|
+
cmd = [sys.executable, "docker_scanner.py", args.dockerfile]
|
|
43
|
+
if image_id:
|
|
44
|
+
cmd.append(image_id)
|
|
45
|
+
|
|
46
|
+
subprocess.run(cmd)
|
|
47
|
+
|
|
48
|
+
print("Analysis complete!")
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
docksec-0.1.0/setup.cfg
ADDED
docksec-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="docksec",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
description="Docker security analysis tool",
|
|
7
|
+
author="Advait Patel",
|
|
8
|
+
py_modules=["docksec"],
|
|
9
|
+
entry_points={
|
|
10
|
+
"console_scripts": [
|
|
11
|
+
"docksec=docksec:main",
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
project_urls={
|
|
15
|
+
"Bug Tracker": "https://github.com/advaitpatel/DockSec/issues",
|
|
16
|
+
"Documentation": "https://github.com/advaitpatel/DockSec/blob/main/README.md",
|
|
17
|
+
"Source Code": "https://github.com/advaitpatel/DockSec",
|
|
18
|
+
},
|
|
19
|
+
python_requires=">=3.12",
|
|
20
|
+
install_requires=[
|
|
21
|
+
"langchain",
|
|
22
|
+
"langchain-openai",
|
|
23
|
+
"python-dotenv",
|
|
24
|
+
"pandas",
|
|
25
|
+
"tqdm",
|
|
26
|
+
"colorama",
|
|
27
|
+
"rich",
|
|
28
|
+
"fpdf",
|
|
29
|
+
"setuptools",
|
|
30
|
+
],
|
|
31
|
+
include_package_data=True,
|
|
32
|
+
)
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
# Initialize device type args
|
|
3
|
+
# use build args in the docker build commmand with --build-arg="BUILDARG=true"
|
|
4
|
+
ARG USE_CUDA=false
|
|
5
|
+
ARG USE_OLLAMA=false
|
|
6
|
+
# Tested with cu117 for CUDA 11 and cu121 for CUDA 12 (default)
|
|
7
|
+
ARG USE_CUDA_VER=cu121
|
|
8
|
+
# any sentence transformer model; models to use can be found at https://huggingface.co/models?library=sentence-transformers
|
|
9
|
+
# Leaderboard: https://huggingface.co/spaces/mteb/leaderboard
|
|
10
|
+
# for better performance and multilangauge support use "intfloat/multilingual-e5-large" (~2.5GB) or "intfloat/multilingual-e5-base" (~1.5GB)
|
|
11
|
+
# IMPORTANT: If you change the embedding model (sentence-transformers/all-MiniLM-L6-v2) and vice versa, you aren't able to use RAG Chat with your previous documents loaded in the manyface! You need to re-embed them.
|
|
12
|
+
ARG USE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
|
|
13
|
+
ARG USE_RERANKING_MODEL=""
|
|
14
|
+
|
|
15
|
+
######## manyface frontend ########
|
|
16
|
+
FROM --platform=$BUILDPLATFORM node:21-alpine3.19 as build
|
|
17
|
+
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
COPY package.json package-lock.json ./
|
|
22
|
+
RUN npm ci
|
|
23
|
+
|
|
24
|
+
COPY . .
|
|
25
|
+
RUN npm run build
|
|
26
|
+
|
|
27
|
+
######## manyface backend ########
|
|
28
|
+
FROM python:3.10.12-slim-bookworm as base
|
|
29
|
+
|
|
30
|
+
# Use args
|
|
31
|
+
ARG USE_CUDA
|
|
32
|
+
ARG USE_OLLAMA
|
|
33
|
+
ARG USE_CUDA_VER
|
|
34
|
+
ARG USE_EMBEDDING_MODEL
|
|
35
|
+
ARG USE_RERANKING_MODEL
|
|
36
|
+
|
|
37
|
+
## Basis ##
|
|
38
|
+
ENV ENV=prod \
|
|
39
|
+
PORT=8080 \
|
|
40
|
+
# pass build args to the build
|
|
41
|
+
USE_OLLAMA_DOCKER=${USE_OLLAMA} \
|
|
42
|
+
USE_CUDA_DOCKER=${USE_CUDA} \
|
|
43
|
+
USE_CUDA_DOCKER_VER=${USE_CUDA_VER} \
|
|
44
|
+
USE_EMBEDDING_MODEL_DOCKER=${USE_EMBEDDING_MODEL} \
|
|
45
|
+
USE_RERANKING_MODEL_DOCKER=${USE_RERANKING_MODEL}
|
|
46
|
+
|
|
47
|
+
## Basis URL Config ##
|
|
48
|
+
ENV OLLAMA_BASE_URL="/ollama" \
|
|
49
|
+
OPENAI_API_BASE_URL=""
|
|
50
|
+
|
|
51
|
+
## API Key and Security Config ##
|
|
52
|
+
ENV OPENAI_API_KEY="" \
|
|
53
|
+
MF_SECRET_KEY="" \
|
|
54
|
+
SCARF_NO_ANALYTICS=true \
|
|
55
|
+
DO_NOT_TRACK=true \
|
|
56
|
+
ANONYMIZED_TELEMETRY=false
|
|
57
|
+
|
|
58
|
+
# Use locally bundled version of the LiteLLM cost map json
|
|
59
|
+
# to avoid repetitive startup connections
|
|
60
|
+
ENV LITELLM_LOCAL_MODEL_COST_MAP="True"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
#### Other models #########################################################
|
|
64
|
+
## whisper TTS model settings ##
|
|
65
|
+
ENV WHISPER_MODEL="base" \
|
|
66
|
+
WHISPER_MODEL_DIR="/app/backend/data/cache/whisper/models"
|
|
67
|
+
|
|
68
|
+
## RAG Embedding model settings ##
|
|
69
|
+
ENV RAG_EMBEDDING_MODEL="$USE_EMBEDDING_MODEL_DOCKER" \
|
|
70
|
+
RAG_RERANKING_MODEL="$USE_RERANKING_MODEL_DOCKER" \
|
|
71
|
+
SENTENCE_TRANSFORMERS_HOME="/app/backend/data/cache/embedding/models"
|
|
72
|
+
|
|
73
|
+
## Hugging Face download cache ##
|
|
74
|
+
ENV HF_HOME="/app/backend/data/cache/embedding/models"
|
|
75
|
+
#### Other models ##########################################################
|
|
76
|
+
|
|
77
|
+
WORKDIR /app/backend
|
|
78
|
+
|
|
79
|
+
ENV HOME /root
|
|
80
|
+
RUN mkdir -p $HOME/.cache/chroma
|
|
81
|
+
RUN echo -n 00000000-0000-0000-0000-000000000000 > $HOME/.cache/chroma/telemetry_user_id
|
|
82
|
+
|
|
83
|
+
RUN if [ "$USE_OLLAMA" = "true" ]; then \
|
|
84
|
+
apt-get update && \
|
|
85
|
+
# Install pandoc and netcat
|
|
86
|
+
apt-get install -y --no-install-recommends pandoc netcat-openbsd && \
|
|
87
|
+
# for RAG OCR
|
|
88
|
+
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
|
|
89
|
+
# install helper tools
|
|
90
|
+
apt-get install -y --no-install-recommends curl && \
|
|
91
|
+
# install ollama
|
|
92
|
+
curl -fsSL https://ollama.com/install.sh | sh && \
|
|
93
|
+
# cleanup
|
|
94
|
+
rm -rf /var/lib/apt/lists/*; \
|
|
95
|
+
else \
|
|
96
|
+
apt-get update && \
|
|
97
|
+
# Install pandoc and netcat
|
|
98
|
+
apt-get install -y --no-install-recommends pandoc netcat-openbsd && \
|
|
99
|
+
# for RAG OCR
|
|
100
|
+
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
|
|
101
|
+
# cleanup
|
|
102
|
+
rm -rf /var/lib/apt/lists/*; \
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# install python dependencies
|
|
106
|
+
COPY ./backend/requirements.txt ./requirements.txt
|
|
107
|
+
|
|
108
|
+
RUN pip3 install uv && \
|
|
109
|
+
if [ "$USE_CUDA" = "true" ]; then \
|
|
110
|
+
# If you use CUDA the whisper and embedding model will be downloaded on first use
|
|
111
|
+
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \
|
|
112
|
+
uv pip install --system -r requirements.txt --no-cache-dir && \
|
|
113
|
+
python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
|
|
114
|
+
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])"; \
|
|
115
|
+
else \
|
|
116
|
+
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \
|
|
117
|
+
uv pip install --system -r requirements.txt --no-cache-dir && \
|
|
118
|
+
python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
|
|
119
|
+
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])"; \
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# copy embedding weight from build
|
|
125
|
+
# RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
|
|
126
|
+
# COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx
|
|
127
|
+
|
|
128
|
+
# copy built frontend files
|
|
129
|
+
COPY --from=build /app/build /app/build
|
|
130
|
+
COPY --from=build /app/CHANGELOG.md /app/CHANGELOG.md
|
|
131
|
+
COPY --from=build /app/package.json /app/package.json
|
|
132
|
+
|
|
133
|
+
# copy backend files
|
|
134
|
+
COPY ./backend .
|
|
135
|
+
|
|
136
|
+
EXPOSE 8080
|
|
137
|
+
|
|
138
|
+
CMD [ "bash", "start.sh"]
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
# Initialize device type args
|
|
3
|
+
# use build args in the docker build command with --build-arg="BUILDARG=true"
|
|
4
|
+
ARG USE_CUDA=false
|
|
5
|
+
ARG USE_OLLAMA=false
|
|
6
|
+
# Tested with cu117 for CUDA 11 and cu121 for CUDA 12 (default)
|
|
7
|
+
ARG USE_CUDA_VER=cu121
|
|
8
|
+
# any sentence transformer model; models to use can be found at https://huggingface.co/models?library=sentence-transformers
|
|
9
|
+
# Leaderboard: https://huggingface.co/spaces/mteb/leaderboard
|
|
10
|
+
# for better performance and multilangauge support use "intfloat/multilingual-e5-large" (~2.5GB) or "intfloat/multilingual-e5-base" (~1.5GB)
|
|
11
|
+
# IMPORTANT: If you change the embedding model (sentence-transformers/all-MiniLM-L6-v2) and vice versa, you aren't able to use RAG Chat with your previous documents loaded in the WebUI! You need to re-embed them.
|
|
12
|
+
ARG USE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
|
|
13
|
+
ARG USE_RERANKING_MODEL=""
|
|
14
|
+
|
|
15
|
+
# Tiktoken encoding name; models to use can be found at https://huggingface.co/models?library=tiktoken
|
|
16
|
+
ARG USE_TIKTOKEN_ENCODING_NAME="cl100k_base"
|
|
17
|
+
|
|
18
|
+
ARG BUILD_HASH=dev-build
|
|
19
|
+
# Override at your own risk - non-root configurations are untested
|
|
20
|
+
ARG UID=0
|
|
21
|
+
ARG GID=0
|
|
22
|
+
|
|
23
|
+
######## WebUI frontend ########
|
|
24
|
+
FROM --platform=$BUILDPLATFORM node:22-alpine3.20 AS build
|
|
25
|
+
ARG BUILD_HASH
|
|
26
|
+
|
|
27
|
+
WORKDIR /app
|
|
28
|
+
|
|
29
|
+
COPY package.json package-lock.json ./
|
|
30
|
+
RUN npm ci
|
|
31
|
+
|
|
32
|
+
COPY . .
|
|
33
|
+
ENV APP_BUILD_HASH=${BUILD_HASH}
|
|
34
|
+
RUN npm run build
|
|
35
|
+
|
|
36
|
+
######## WebUI backend ########
|
|
37
|
+
FROM python:3.11-slim-bookworm AS base
|
|
38
|
+
|
|
39
|
+
# Use args
|
|
40
|
+
ARG USE_CUDA
|
|
41
|
+
ARG USE_OLLAMA
|
|
42
|
+
ARG USE_CUDA_VER
|
|
43
|
+
ARG USE_EMBEDDING_MODEL
|
|
44
|
+
ARG USE_RERANKING_MODEL
|
|
45
|
+
ARG UID
|
|
46
|
+
ARG GID
|
|
47
|
+
|
|
48
|
+
## Basis ##
|
|
49
|
+
ENV ENV=prod \
|
|
50
|
+
PORT=8080 \
|
|
51
|
+
# pass build args to the build
|
|
52
|
+
USE_OLLAMA_DOCKER=${USE_OLLAMA} \
|
|
53
|
+
USE_CUDA_DOCKER=${USE_CUDA} \
|
|
54
|
+
USE_CUDA_DOCKER_VER=${USE_CUDA_VER} \
|
|
55
|
+
USE_EMBEDDING_MODEL_DOCKER=${USE_EMBEDDING_MODEL} \
|
|
56
|
+
USE_RERANKING_MODEL_DOCKER=${USE_RERANKING_MODEL}
|
|
57
|
+
|
|
58
|
+
## Basis URL Config ##
|
|
59
|
+
ENV OLLAMA_BASE_URL="/ollama" \
|
|
60
|
+
OPENAI_API_BASE_URL=""
|
|
61
|
+
|
|
62
|
+
## API Key and Security Config ##
|
|
63
|
+
ENV OPENAI_API_KEY="" \
|
|
64
|
+
WEBUI_SECRET_KEY="" \
|
|
65
|
+
SCARF_NO_ANALYTICS=true \
|
|
66
|
+
DO_NOT_TRACK=true \
|
|
67
|
+
ANONYMIZED_TELEMETRY=false
|
|
68
|
+
|
|
69
|
+
#### Other models #########################################################
|
|
70
|
+
## whisper TTS model settings ##
|
|
71
|
+
ENV WHISPER_MODEL="base" \
|
|
72
|
+
WHISPER_MODEL_DIR="/app/backend/data/cache/whisper/models"
|
|
73
|
+
|
|
74
|
+
## RAG Embedding model settings ##
|
|
75
|
+
ENV RAG_EMBEDDING_MODEL="$USE_EMBEDDING_MODEL_DOCKER" \
|
|
76
|
+
RAG_RERANKING_MODEL="$USE_RERANKING_MODEL_DOCKER" \
|
|
77
|
+
SENTENCE_TRANSFORMERS_HOME="/app/backend/data/cache/embedding/models"
|
|
78
|
+
|
|
79
|
+
## Tiktoken model settings ##
|
|
80
|
+
ENV TIKTOKEN_ENCODING_NAME="cl100k_base" \
|
|
81
|
+
TIKTOKEN_CACHE_DIR="/app/backend/data/cache/tiktoken"
|
|
82
|
+
|
|
83
|
+
## Hugging Face download cache ##
|
|
84
|
+
ENV HF_HOME="/app/backend/data/cache/embedding/models"
|
|
85
|
+
|
|
86
|
+
## Torch Extensions ##
|
|
87
|
+
# ENV TORCH_EXTENSIONS_DIR="/.cache/torch_extensions"
|
|
88
|
+
|
|
89
|
+
#### Other models ##########################################################
|
|
90
|
+
|
|
91
|
+
WORKDIR /app/backend
|
|
92
|
+
|
|
93
|
+
ENV HOME=/root
|
|
94
|
+
# Create user and group if not root
|
|
95
|
+
RUN if [ $UID -ne 0 ]; then \
|
|
96
|
+
if [ $GID -ne 0 ]; then \
|
|
97
|
+
addgroup --gid $GID app; \
|
|
98
|
+
fi; \
|
|
99
|
+
adduser --uid $UID --gid $GID --home $HOME --disabled-password --no-create-home app; \
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
RUN mkdir -p $HOME/.cache/chroma
|
|
103
|
+
RUN echo -n 00000000-0000-0000-0000-000000000000 > $HOME/.cache/chroma/telemetry_user_id
|
|
104
|
+
|
|
105
|
+
# Make sure the user has access to the app and root directory
|
|
106
|
+
RUN chown -R $UID:$GID /app $HOME
|
|
107
|
+
|
|
108
|
+
RUN if [ "$USE_OLLAMA" = "true" ]; then \
|
|
109
|
+
apt-get update && \
|
|
110
|
+
# Install pandoc and netcat
|
|
111
|
+
apt-get install -y --no-install-recommends git build-essential pandoc netcat-openbsd curl && \
|
|
112
|
+
apt-get install -y --no-install-recommends gcc python3-dev && \
|
|
113
|
+
# for RAG OCR
|
|
114
|
+
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
|
|
115
|
+
# install helper tools
|
|
116
|
+
apt-get install -y --no-install-recommends curl jq && \
|
|
117
|
+
# install ollama
|
|
118
|
+
curl -fsSL https://ollama.com/install.sh | sh && \
|
|
119
|
+
# cleanup
|
|
120
|
+
rm -rf /var/lib/apt/lists/*; \
|
|
121
|
+
else \
|
|
122
|
+
apt-get update && \
|
|
123
|
+
# Install pandoc, netcat and gcc
|
|
124
|
+
apt-get install -y --no-install-recommends git build-essential pandoc gcc netcat-openbsd curl jq && \
|
|
125
|
+
apt-get install -y --no-install-recommends gcc python3-dev && \
|
|
126
|
+
# for RAG OCR
|
|
127
|
+
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
|
|
128
|
+
# cleanup
|
|
129
|
+
rm -rf /var/lib/apt/lists/*; \
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# install python dependencies
|
|
133
|
+
COPY --chown=$UID:$GID ./backend/requirements.txt ./requirements.txt
|
|
134
|
+
|
|
135
|
+
RUN pip3 install uv && \
|
|
136
|
+
if [ "$USE_CUDA" = "true" ]; then \
|
|
137
|
+
# If you use CUDA the whisper and embedding model will be downloaded on first use
|
|
138
|
+
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \
|
|
139
|
+
uv pip install --system -r requirements.txt --no-cache-dir && \
|
|
140
|
+
python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
|
|
141
|
+
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])"; \
|
|
142
|
+
python -c "import os; import tiktoken; tiktoken.get_encoding(os.environ['TIKTOKEN_ENCODING_NAME'])"; \
|
|
143
|
+
else \
|
|
144
|
+
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \
|
|
145
|
+
uv pip install --system -r requirements.txt --no-cache-dir && \
|
|
146
|
+
python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
|
|
147
|
+
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])"; \
|
|
148
|
+
python -c "import os; import tiktoken; tiktoken.get_encoding(os.environ['TIKTOKEN_ENCODING_NAME'])"; \
|
|
149
|
+
fi; \
|
|
150
|
+
chown -R $UID:$GID /app/backend/data/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
# copy embedding weight from build
|
|
155
|
+
# RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
|
|
156
|
+
# COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx
|
|
157
|
+
|
|
158
|
+
# copy built frontend files
|
|
159
|
+
COPY --chown=$UID:$GID --from=build /app/build /app/build
|
|
160
|
+
COPY --chown=$UID:$GID --from=build /app/CHANGELOG.md /app/CHANGELOG.md
|
|
161
|
+
COPY --chown=$UID:$GID --from=build /app/package.json /app/package.json
|
|
162
|
+
|
|
163
|
+
# copy backend files
|
|
164
|
+
COPY --chown=$UID:$GID ./backend .
|
|
165
|
+
|
|
166
|
+
EXPOSE 8080
|
|
167
|
+
|
|
168
|
+
HEALTHCHECK CMD curl --silent --fail http://localhost:${PORT:-8080}/health | jq -ne 'input.status == true' || exit 1
|
|
169
|
+
|
|
170
|
+
USER $UID:$GID
|
|
171
|
+
|
|
172
|
+
ARG BUILD_HASH
|
|
173
|
+
ENV WEBUI_BUILD_VERSION=${BUILD_HASH}
|
|
174
|
+
ENV DOCKER=true
|
|
175
|
+
|
|
176
|
+
CMD [ "bash", "start.sh"]
|