Skip to content

Commit 795eac7

Browse files
committed
reduce vulnerabilities
1 parent 388a119 commit 795eac7

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

starter/Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
ARG BASE_IMAGE="python:3.12-slim-bookworm@sha256:31a416db24bd8ade7dac5fd5999ba6c234d7fa79d4add8781e95f41b187f4c9a"
22
FROM ${BASE_IMAGE} AS compile-image
33

4+
ARG DOCKER_VERSION="28.1.1"
5+
46
RUN apt-get update --fix-missing && \
57
apt-get upgrade -y && \
6-
apt-get install -y gcc
8+
apt-get install -y gcc curl bzip2 unzip
9+
10+
# Get docker binary
11+
ADD https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz /
12+
RUN tar --extract --file docker-${DOCKER_VERSION}.tgz --directory /tmp/ --strip-components 1
713

814
WORKDIR /opt/seatable-python-starter
915
COPY ["./requirements.txt", "/opt/seatable-python-starter/"]
1016

1117
# Upgrade setuptools to fix vulnerabilities
1218
RUN pip install --upgrade setuptools && \
1319
pip install --upgrade --user setuptools && \
14-
pip install -r /opt/seatable-python-starter/requirements.txt --user --break-system-packages
20+
pip install -r /opt/seatable-python-starter/requirements.txt --user
1521

1622
### Runtime image
1723
FROM ${BASE_IMAGE} AS runtime-image
@@ -23,13 +29,13 @@ RUN apt-get update --fix-missing && \
2329
tzdata \
2430
procps \
2531
cron \
26-
logrotate \
27-
docker.io \
28-
gcc \
29-
curl && \
32+
logrotate && \
3033
apt-get autoremove -y && \
3134
apt-get clean
3235

36+
COPY --from=build-image /tmp/docker /usr/local/bin/docker
37+
RUN chmod +x /usr/local/bin/docker
38+
3339
WORKDIR /opt/seatable-python-starter
3440
COPY ["./", "./"]
3541

starter/entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ fi
6969
echo "** uWSGI is starting now"
7070
uwsgi --ini /opt/seatable-python-starter/uwsgi.ini 2>&1 &
7171
sleep 1
72-
if curl -IsSf http://127.0.0.1:8080/ping/ >/dev/null 2>&1; then
72+
if echo -e "HEAD /ping/ HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n" | \
73+
timeout 2 bash -c 'cat < /dev/tcp/127.0.0.1/8080' >/dev/null 2>&1; then
7374
echo "** SeaTable Python Starter ready"
7475
else
7576
echo "** Error: SeaTable Python Starter is not ready. uWSGI is not answering."

0 commit comments

Comments
 (0)