-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (30 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
37 lines (30 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Commands to build container
# docker build -t biolabs/pubtrends .
#
# Push to Docker hub
# docker login -u biolabs && docker push biolabs/pubtrends
FROM python:3.10-slim
LABEL author="Oleg Shpynov"
LABEL email="os@jetbrains.com"
# Install only essential packages and cleanup in one layer
RUN DEBIAN_FRONTEND="noninteractive" apt-get update --fix-missing \
&& apt-get install --no-install-recommends -y \
curl ca-certificates gcc g++ libpq-dev \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Make new user
RUN groupadd -r pubtrends && useradd -ms /bin/bash -g pubtrends user
# Install uv and Python dependencies
USER user
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/home/user/.local/bin:$PATH"
# Install required dependencies from pyproject.toml
COPY --chown=user:pubtrends pyproject.toml /home/user/pyproject.toml
WORKDIR /home/user
RUN uv venv /home/user/.venv \
&& uv sync --no-install-project --extra-index-url https://download.pytorch.org/whl/cpu \
&& rm -rf /home/user/.cache
ENV PATH="/home/user/.venv/bin:$PATH"
ENV VIRTUAL_ENV="/home/user/.venv"
ENV PYTHONUNBUFFERED=1