added uvicorn

This commit is contained in:
scshiv29-dev
2022-05-11 22:54:13 +05:30
parent cd3663038f
commit c376123877
2 changed files with 124 additions and 53 deletions

View File

@@ -36,8 +36,7 @@ const createDockerfile = async (data, image): Promise<void> => {
Dockerfile.push(`RUN pip install gunicorn`);
} else if (pythonWSGI?.toLowerCase() === "uvicorn") {
Dockerfile.push(`RUN pip install uvicorn`);
}
else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
} else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
Dockerfile.push(`RUN apk add --no-cache uwsgi-python3`);
// Dockerfile.push(`RUN pip install --no-cache-dir uwsgi`)
}
@@ -52,12 +51,11 @@ const createDockerfile = async (data, image): Promise<void> => {
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
Dockerfile.push(`EXPOSE ${port}`);
if (pythonWSGI?.toLowerCase() === 'gunicorn') {
Dockerfile.push(`CMD gunicorn ${pythonModule}:${pythonVariable}`);
Dockerfile.push(`CMD gunicorn -w=4 -b=0.0.0.0:8000 ${pythonModule}:${pythonVariable}`);
} else if (pythonWSGI?.toLowerCase() === "uvicorn") {
Dockerfile.push(`CMD uvicorn ${pythonModule}:${pythonVariable} --reload --port ${port}`);
}
else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
} else if (pythonWSGI?.toLowerCase() === 'uwsgi') {
Dockerfile.push(
`CMD uwsgi --master -p 4 --http-socket 0.0.0.0:8000 --uid uwsgi --plugins python3 --protocol uwsgi --wsgi ${pythonModule}:${pythonVariable}`
);
@@ -76,4 +74,4 @@ export default async function (data) {
} catch (error) {
throw error;
}
}
}