deploy-stack 0.2.7 → 0.2.9
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.
package/package.json
CHANGED
package/src/utils/generator.js
CHANGED
|
@@ -43,14 +43,75 @@ export async function generateTemplates(targetDir, config) {
|
|
|
43
43
|
|
|
44
44
|
// 5. Handle .gitignore appending cleanly
|
|
45
45
|
const targetGitignore = path.join(targetDir, '.gitignore');
|
|
46
|
-
const gitignoreContent = await fs.readFile(path.join(templatesDir, '_gitignore'), 'utf-8');
|
|
47
46
|
|
|
48
47
|
if (!fsSync.existsSync(targetGitignore)) {
|
|
49
|
-
await fs.writeFile(targetGitignore, gitignoreContent);
|
|
48
|
+
await fs.writeFile(targetGitignore, gitignoreContent(options.finalFramework));
|
|
50
49
|
} else {
|
|
51
50
|
const existingGitignore = await fs.readFile(targetGitignore, 'utf-8');
|
|
52
51
|
if (!existingGitignore.includes('terraform/.terraform/')) {
|
|
53
|
-
|
|
52
|
+
const appendIgnore = '\n# Added by deploy-stack (Terraform)\nterraform/.terraform/\nterraform/*.tfstate\nterraform/*.tfstate.backup\nterraform/.terraform.lock.hcl\nterraform/secret_keys.json\nterraform/.terraform.*\n.env\n';
|
|
53
|
+
await fs.appendFile(targetGitignore, appendIgnore);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getGitignoreContent(framework) {
|
|
59
|
+
const baseIgnore = `
|
|
60
|
+
# Infrastructure (deploy-stack)
|
|
61
|
+
terraform/.terraform/
|
|
62
|
+
terraform/*.tfstate
|
|
63
|
+
terraform/*.tfstate.backup
|
|
64
|
+
terraform/.terraform.lock.hcl
|
|
65
|
+
terraform/secret_keys.json
|
|
66
|
+
terraform/.terraform.*
|
|
67
|
+
.env
|
|
68
|
+
|
|
69
|
+
# OS
|
|
70
|
+
.DS_Store
|
|
71
|
+
Thumbs.db
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const nodeIgnore = `
|
|
75
|
+
# Node.js
|
|
76
|
+
node_modules/
|
|
77
|
+
npm-debug.log
|
|
78
|
+
yarn-error.log
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
const nextjsIgnore = `
|
|
82
|
+
# Next.js
|
|
83
|
+
node_modules/
|
|
84
|
+
.next/
|
|
85
|
+
out/
|
|
86
|
+
build/
|
|
87
|
+
next-env.d.ts
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const pythonIgnore = `
|
|
91
|
+
# Python
|
|
92
|
+
__pycache__/
|
|
93
|
+
*.py[cod]
|
|
94
|
+
*$py.class
|
|
95
|
+
venv/
|
|
96
|
+
env/
|
|
97
|
+
.venv/
|
|
98
|
+
.pytest_cache/
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const staticIgnore = `
|
|
102
|
+
# Static Sites
|
|
103
|
+
node_modules/
|
|
104
|
+
dist/
|
|
105
|
+
build/
|
|
106
|
+
.cache/
|
|
107
|
+
public/
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
let frameworkIgnore = '';
|
|
111
|
+
if (framework === 'node') frameworkIgnore = nodeIgnore;
|
|
112
|
+
if (framework === 'nextjs') frameworkIgnore = nextjsIgnore;
|
|
113
|
+
if (framework === 'python') frameworkIgnore = pythonIgnore;
|
|
114
|
+
if (framework === 'static') frameworkIgnore = staticIgnore;
|
|
115
|
+
|
|
116
|
+
return (baseIgnore + frameworkIgnore).trim();
|
|
56
117
|
}
|
package/src/utils/warnings.js
CHANGED
|
@@ -14,7 +14,11 @@ export function getFrameworkWarning(frameworkId) {
|
|
|
14
14
|
color.yellow('\n 1. Ensure your package.json has a "start" script (e.g., "start": "node index.js").') +
|
|
15
15
|
color.yellow('\n 2. Your app must listen on 0.0.0.0 (not localhost) to receive traffic in Docker.\n\n')
|
|
16
16
|
);
|
|
17
|
-
|
|
17
|
+
case 'python':
|
|
18
|
+
return color.yellow(' ⚠️ IMPORTANT: PYTHON SETUP REQUIRED ') +
|
|
19
|
+
color.yellow('\n 1. Ensure your requirements.txt includes your web framework (e.g., fastapi, uvicorn).') +
|
|
20
|
+
color.yellow('\n 2. Your app must listen on 0.0.0.0 (not localhost) to receive traffic in Docker.') +
|
|
21
|
+
color.yellow('\n 3. Ensure your app has a health check route returning 200 OK.\n\n');
|
|
18
22
|
default:
|
|
19
23
|
return '';
|
|
20
24
|
}
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
FROM python:3.11-slim
|
|
2
|
+
|
|
3
|
+
# Prevent Python from writing .pyc files and buffer stdout for cleaner logs
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
ENV PYTHONUNBUFFERED=1
|
|
6
|
+
|
|
2
7
|
WORKDIR /app
|
|
8
|
+
|
|
9
|
+
# Create a non-root user for security compliance
|
|
10
|
+
RUN adduser --disabled-password --gecos '' appuser
|
|
11
|
+
|
|
12
|
+
# Install dependencies without caching to keep the image size small
|
|
3
13
|
COPY requirements.txt .
|
|
4
|
-
RUN pip install -r requirements.txt
|
|
14
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
15
|
+
|
|
5
16
|
COPY . .
|
|
17
|
+
|
|
18
|
+
# Secure file permissions
|
|
19
|
+
RUN chown -R appuser:appuser /app
|
|
20
|
+
|
|
21
|
+
# Drop root privileges
|
|
22
|
+
USER appuser
|
|
23
|
+
|
|
6
24
|
EXPOSE {{PORT}}
|
|
25
|
+
|
|
7
26
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "{{PORT}}"]
|
package/templates/_gitignore
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Terraform
|
|
2
|
-
terraform/.terraform/
|
|
3
|
-
terraform/*.tfstate
|
|
4
|
-
terraform/*.tfstate.backup
|
|
5
|
-
terraform/.terraform.lock.hcl
|
|
6
|
-
terraform/secret_keys.json
|
|
7
|
-
terraform/.terraform.*
|
|
8
|
-
|
|
9
|
-
# Node & Next.js
|
|
10
|
-
node_modules/
|
|
11
|
-
.next/
|
|
12
|
-
.env
|
|
13
|
-
.env.*
|
|
14
|
-
!.env.example
|
|
15
|
-
|
|
16
|
-
# Python
|
|
17
|
-
__pycache__/
|
|
18
|
-
*.pyc
|
|
19
|
-
venv/
|