-
Notifications
You must be signed in to change notification settings - Fork 37
/
Dockerfile
55 lines (41 loc) · 1.21 KB
/
Dockerfile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Use full image for build
FROM python:3.11-bullseye as build
# Install poetry globally
RUN pip install poetry==1.3.2
RUN poetry --version
# Create virtualenv for deployment
ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies
COPY pyproject.toml poetry.lock ./
RUN poetry install --only main
WORKDIR /opt/wgbstools
COPY setup.py ./
COPY src ./src
RUN python setup.py
####################################################
# Use slim image for deployment
FROM python:3.11-slim-bullseye
RUN apt-get update ; \
apt-get -y install \
samtools \
tabix \
bedtools \
wget \
unzip \
; \
rm -rf /var/lib/apt/lists/*
# Create user and switch to it
RUN groupadd -g 1002 appuser && useradd -u 1002 -g appuser -m appuser
WORKDIR /home/appuser
# Use the previously built virtualenv
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=build /opt/venv /opt/venv
COPY --from=build /opt/wgbstools /opt/wgbstools
RUN mkdir -p /opt/wgbstools/references && chown appuser /opt/wgbstools/references
RUN ln -s /opt/wgbstools/src/python/wgbs_tools.py /usr/local/bin/wgbstools
USER appuser
# App
ENTRYPOINT /bin/bash