Skip to content

Commit cfa41c7

Browse files
bundled docker
1 parent 68c5c5c commit cfa41c7

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

Dockerfile

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,23 @@ RUN apt-get install -y --no-install-recommends build-essential gcc
55

66
WORKDIR /usr/app
77

8-
RUN python -m venv /usr/app/venv
9-
ENV PATH="/usr/app/venv/bin:$PATH"
8+
#install node and npm
9+
RUN apt-get update -y
10+
RUN apt-get install -y ca-certificates curl gnupg
11+
RUN mkdir -p /etc/apt/keyrings
12+
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
13+
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
14+
RUN apt-get update -y
15+
RUN apt-get install nodejs -y
16+
17+
RUN npm install -g renovate -y
18+
19+
ENV VIRTUAL_ENV=/usr/app/venv
1020

11-
copy requirements.txt .
21+
RUN python -m venv $VIRTUAL_ENV
22+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
23+
24+
COPY requirements.txt .
1225

1326
RUN pip install -r requirements.txt
1427

@@ -23,9 +36,24 @@ WORKDIR /usr/app
2336
COPY --chown=python:python --from=build /usr/app/venv ./venv
2437
COPY --chown=python:python . .
2538

39+
2640
USER 999
2741

2842
ENV PATH="/usr/app/venv/bin:$PATH"
2943

30-
CMD ["bash"]
44+
RUN pip install build
45+
46+
#Build the app
47+
RUN python -m build
48+
49+
50+
#Find the wheel file name and install the wheel
51+
RUN pip install $(find dist -name "*.whl")
52+
53+
EXPOSE 5000
54+
55+
RUN chmod 755 ./run.sh
56+
57+
ENTRYPOINT ["./run.sh"]
3158

59+
# CMD ["python", "./src/scsctl/server.py"]

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ clickhouse-driver==0.2.6
44
requests==2.31.0
55
questionary==1.10.0
66
tabulate==0.9.0
7-
kubernetes==27.2.0
7+
kubernetes==27.2.0
8+
uvicorn==0.23.2
9+
fastapi==0.103.1

run.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Get the argument to variable and check if its a server, if it is then start the server.
4+
if [ "$1" = 'server' ]; then
5+
echo "Starting server"
6+
exec python ./src/scsctl/server.py
7+
fi
8+
9+
# If the argument is anything else then run scsctl as entrypoint.
10+
exec scsctl "$@"

src/scsctl/server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
)
2020

2121
from datetime import datetime
22-
import subprocess
2322

2423
from scsctl.helper.renovate import (check_if_node_and_npm_is_installed,check_if_renovate_is_installed_globally,run_renovate_on_a_repository)
2524

@@ -140,4 +139,4 @@ async def scan_api(config: Config):
140139
}
141140

142141
if __name__ == "__main__":
143-
uvicorn.run("server:app", port=5000, log_level="info", reload=True)
142+
uvicorn.run("server:app", host="0.0.0.0",port=5000, log_level="info", reload=True)

0 commit comments

Comments
 (0)