1- # SPDX-License-Identifier: Apache-2.0
2- #
3- # http://nexb.com and https://github.com/aboutcode-org/scancode.io
4- # The ScanCode.io software is licensed under the Apache License version 2.0.
5- # Data generated with ScanCode.io is provided as-is without warranties.
6- # ScanCode is a trademark of nexB Inc.
7- #
8- # You may not use this software except in compliance with the License.
9- # You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10- # Unless required by applicable law or agreed to in writing, software distributed
11- # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12- # CONDITIONS OF ANY KIND, either express or implied. See the License for the
13- # specific language governing permissions and limitations under the License.
14- #
15- # Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
16- # OR CONDITIONS OF ANY KIND, either express or implied. No content created from
17- # ScanCode.io should be considered or used as legal advice. Consult an Attorney
18- # for any legal advice.
19- #
20- # ScanCode.io is a free software code scanning tool from nexB Inc. and others.
21- # Visit https://github.com/aboutcode-org/scancode.io for support and download.
22-
23- FROM python:3.13-slim
24-
25- LABEL org.opencontainers.image.source="https://github.com/aboutcode-org/scancode.io"
26- LABEL org.opencontainers.image.description="ScanCode.io"
27- LABEL org.opencontainers.image.licenses="Apache-2.0"
28-
29- ENV APP_NAME scancodeio
30- ENV APP_USER app
31- ENV APP_DIR /opt/$APP_NAME
32- ENV VENV_LOCATION /opt/$APP_NAME/.venv
33-
34- # Force Python unbuffered stdout and stderr (they are flushed to terminal immediately)
35- ENV PYTHONUNBUFFERED 1
36- # Do not write Python .pyc files
37- ENV PYTHONDONTWRITEBYTECODE 1
38- # Add the app dir in the Python path for entry points availability
39- ENV PYTHONPATH $PYTHONPATH:$APP_DIR
40-
41- # OS requirements as per
42- # https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html
43- # Also install universal-ctags and xgettext for symbol and string collection.
44- RUN apt-get update \
45- && apt-get install -y --no-install-recommends \
46- bzip2 \
47- xz-utils \
48- zlib1g \
49- libxml2-dev \
50- libxslt1-dev \
51- libgomp1 \
52- libsqlite3-0 \
53- libgcrypt20 \
54- libpopt0 \
55- libzstd1 \
56- libgpgme11 \
57- libdevmapper1.02.1 \
58- libguestfs-tools \
59- linux-image-amd64 \
60- git \
61- wait-for-it \
62- universal-ctags \
63- gettext \
64- && apt-get clean \
65- && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
66-
67- # Create the APP_USER group and user
68- RUN addgroup --system $APP_USER \
69- && adduser --system --group --home=$APP_DIR $APP_USER \
70- && chown $APP_USER:$APP_USER $APP_DIR
71-
72- # Create the /var/APP_NAME directory with proper permission for APP_USER
73- RUN mkdir -p /var/$APP_NAME \
74- && chown $APP_USER:$APP_USER /var/$APP_NAME
75-
76- # Setup the work directory and the user as APP_USER for the remaining stages
77- WORKDIR $APP_DIR
78- USER $APP_USER
79-
80- # Create the virtualenv
81- RUN python -m venv $VENV_LOCATION
82- # Enable the virtualenv, similar effect as "source activate"
83- ENV PATH $VENV_LOCATION/bin:$PATH
84-
85- # Create static/ and workspace/ directories
86- RUN mkdir -p /var/$APP_NAME/static/ \
87- && mkdir -p /var/$APP_NAME/workspace/
88-
89- # Install the dependencies before the codebase COPY for proper Docker layer caching
90- COPY --chown=$APP_USER:$APP_USER pyproject.toml $APP_DIR/
91- RUN pip install --no-cache-dir .
92-
93- # Copy the codebase and set the proper permissions for the APP_USER
1+ # SPDX-License-Identifier: Apache-2.0
2+ #
3+ # http://nexb.com and https://github.com/aboutcode-org/scancode.io
4+ # The ScanCode.io software is licensed under the Apache License version 2.0.
5+ # Data generated with ScanCode.io is provided as-is without warranties.
6+ # ScanCode is a trademark of nexB Inc.
7+ #
8+ # You may not use this software except in compliance with the License.
9+ # You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10+ # Unless required by applicable law or agreed to in writing, software distributed
11+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+ # specific language governing permissions and limitations under the License.
14+ #
15+ # Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
16+ # OR CONDITIONS OF ANY KIND, either express or implied. No content created from
17+ # ScanCode.io should be considered or used as legal advice. Consult an Attorney
18+ # for any legal advice.
19+ #
20+ # ScanCode.io is a free software code scanning tool from nexB Inc. and others.
21+ # Visit https://github.com/aboutcode-org/scancode.io for support and download.
22+
23+ FROM python:3.13-slim
24+
25+ LABEL org.opencontainers.image.source="https://github.com/aboutcode-org/scancode.io"
26+ LABEL org.opencontainers.image.description="ScanCode.io"
27+ LABEL org.opencontainers.image.licenses="Apache-2.0"
28+
29+ ENV APP_NAME scancodeio
30+ ENV APP_USER app
31+ ENV APP_DIR /opt/$APP_NAME
32+ ENV VENV_LOCATION /opt/$APP_NAME/.venv
33+
34+ # Force Python unbuffered stdout and stderr (they are flushed to terminal immediately)
35+ ENV PYTHONUNBUFFERED 1
36+ # Do not write Python .pyc files
37+ ENV PYTHONDONTWRITEBYTECODE 1
38+ # Add the app dir in the Python path for entry points availability
39+ ENV PYTHONPATH $PYTHONPATH:$APP_DIR
40+
41+ # OS requirements as per
42+ # https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html
43+ # Also install universal-ctags and xgettext for symbol and string collection.
44+ RUN apt-get update \
45+ && apt-get install -y --no-install-recommends \
46+ bzip2 \
47+ xz-utils \
48+ zlib1g \
49+ libxml2-dev \
50+ libxslt1-dev \
51+ libgomp1 \
52+ libsqlite3-0 \
53+ libgcrypt20 \
54+ libpopt0 \
55+ libzstd1 \
56+ libgpgme11 \
57+ libdevmapper1.02.1 \
58+ libguestfs-tools \
59+ linux-image-amd64 \
60+ git \
61+ wait-for-it \
62+ universal-ctags \
63+ gettext \
64+ && apt-get clean \
65+ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
66+
67+ # Create the APP_USER group and user
68+ RUN addgroup --system $APP_USER \
69+ && adduser --system --group --home=$APP_DIR $APP_USER \
70+ && chown $APP_USER:$APP_USER $APP_DIR
71+
72+ # Create the /var/APP_NAME directory with proper permission for APP_USER
73+ RUN mkdir -p /var/$APP_NAME \
74+ && chown $APP_USER:$APP_USER /var/$APP_NAME
75+
76+ # Setup the work directory and the user as APP_USER for the remaining stages
77+ WORKDIR $APP_DIR
78+ USER $APP_USER
79+
80+ # Create the virtualenv
81+ RUN python -m venv $VENV_LOCATION
82+ # Enable the virtualenv, similar effect as "source activate"
83+ ENV PATH $VENV_LOCATION/bin:$PATH
84+
85+ # Create static/ and workspace/ directories
86+ RUN mkdir -p /var/$APP_NAME/static/ \
87+ && mkdir -p /var/$APP_NAME/workspace/
88+
89+ # Install the dependencies before the codebase COPY for proper Docker layer caching
90+ COPY --chown=$APP_USER:$APP_USER pyproject.toml $APP_DIR/
91+ RUN pip install --no-cache-dir .
92+
93+ # Copy the codebase and set the proper permissions for the APP_USER
9494COPY --chown=$APP_USER:$APP_USER . $APP_DIR
0 commit comments