Skip to content

Commit 0d1c7fc

Browse files
authored
Merge pull request #260 from MannLabs/add-dockerfile
add Dockerfile, workflow, and Readme
2 parents fafe475 + e025edb commit 0d1c7fc

File tree

4 files changed

+128
-24
lines changed

4 files changed

+128
-24
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build and publish Docker image
2+
name: Publish Docker image
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
tag_to_release:
8+
description: 'Enter tag to release (example: v1.5.5). A tag with this name must exist in the repository.'
9+
type: string
10+
required: true
11+
12+
jobs:
13+
publish_on_pypi:
14+
uses: MannLabs/alphashared/.github/workflows/publish_docker.yml@v1
15+
secrets:
16+
docker_access_token: ${{ secrets.DOCKER_ACCESS_TOKEN }}
17+
docker_username: ${{ secrets.DOCKER_USERNAME }}
18+
with:
19+
package_name: peptdeep
20+
tag_to_release: ${{ inputs.tag_to_release }}

Dockerfile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM --platform=linux/amd64 python:3.11-bookworm
4+
5+
# Prevents Python from writing pyc files.
6+
ENV PYTHONDONTWRITEBYTECODE=1
7+
# Keeps Python from buffering stdout and stderr to avoid situations where
8+
# the application crashes without emitting any logs due to buffering.
9+
ENV PYTHONUNBUFFERED=1
10+
11+
WORKDIR /app
12+
13+
14+
# Create a non-privileged user that the app will run under.
15+
# See https://docs.docker.com/go/dockerfile-user-best-practices/
16+
ARG UID=10001
17+
RUN adduser \
18+
--disabled-password \
19+
--gecos "" \
20+
--home "/home/peptdeepuser" \
21+
--shell "/sbin/nologin" \
22+
--uid "${UID}" \
23+
peptdeepuser
24+
25+
26+
COPY requirements requirements
27+
# restrict to CPU-only PyTorch wheels (to reduce image size), part 1
28+
RUN sed -i '/^torch/i\--extra-index-url https://download.pytorch.org/whl/cpu' requirements/requirements.txt
29+
30+
31+
RUN pip install --no-cache-dir -r requirements/requirements.txt
32+
RUN pip install --no-cache-dir -r requirements/requirements_gui.txt
33+
34+
# restrict to CPU-only PyTorch wheels, part 2
35+
RUN sed -i '/^--extra-index-url https:\/\/download.pytorch.org\/whl\/cpu$/d' requirements/requirements.txt
36+
RUN sed -i '/^torch/d' requirements/requirements.txt
37+
38+
COPY peptdeep peptdeep
39+
COPY MANIFEST.in MANIFEST.in
40+
COPY LICENSE.txt LICENSE.txt
41+
COPY README.md README.md
42+
COPY pyproject.toml pyproject.toml
43+
44+
RUN pip install --no-cache-dir ".[stable,gui-stable]"
45+
46+
ENV PORT=8501
47+
EXPOSE 8501
48+
49+
USER peptdeepuser
50+
51+
CMD ["/usr/local/bin/peptdeep", "gui", "--port", "8501"]
52+
53+
# build & run:
54+
# docker build --progress=plain -t peptdeep .
55+
# DATA_FOLDER=/path/to/local/data
56+
# docker run -p 8501:8501 -v $DATA_FOLDER:/app/data/ -t peptdeep

README.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# AlphaPeptDeep (PeptDeep)
21

32
[![Default installation and tests](https://github.com/MannLabs/alphapeptdeep/actions/workflows/pip_installation.yml/badge.svg)](https://github.com/MannLabs/alphapeptdeep/actions/workflows/pip_installation.yml)
43
[![Publish on PyPi and release on GitHub](https://github.com/MannLabs/alphapeptdeep/actions/workflows/publish_on_pypi.yml/badge.svg)](https://github.com/MannLabs/alphapeptdeep/actions/workflows/publish_and_release.yml)
@@ -10,21 +9,21 @@
109
[![pip downloads](https://img.shields.io/pypi/dm/peptdeep?color=blue&label=pip%20downloads)](https://pypi.org/project/peptdeep)
1110
![Python](https://img.shields.io/pypi/pyversions/peptdeep)
1211

12+
# AlphaPeptDeep (PeptDeep)
13+
1314
------------------------------------------------------------------------
1415

1516
<!-- PROJECT LOGO -->
1617
<br />
1718
<div align="center">
18-
<a href="https://github.com/othneildrew/Best-README-Template">
19-
<img src="peptdeep/webui/logos/peptdeep.png" alt="Logo" width="80" height="80">
20-
</a>
19+
<img src="peptdeep/webui/logos/peptdeep.png" alt="Logo" width="80" height="80">
2120

22-
<h3 align="center">AlphaPeptDeep</h3>
21+
<h3 align="center">PeptDeep</h3>
2322

2423
<p align="center">
2524
<a href="https://doi.org/10.1038/s41467-022-34904-3">Publication</a>
2625
·
27-
<a href="https://github.com/Mannlabs/peptdeeo/releases/latest">Download</a>
26+
<a href="https://github.com/Mannlabs/peptdeep/releases/latest">Download</a>
2827
·
2928
<a href="#installation">Installation</a>
3029
·
@@ -69,20 +68,21 @@ Visit [alphapept.org](https://alphapept.org) for other packages of AlphaPept eco
6968
AlphaPeptDeep can be installed and used on all major operating systems
7069
(Windows, macOS and Linux).
7170

72-
There are three different types of installation possible:
71+
There are different types of installation possible:
7372

74-
- [**One-click GUI installation:**](#one-click-gui) Choose this
73+
- [**One-click GUI installation:**](#one-click-gui-installation) Choose this
7574
installation if you only want the GUI and/or keep things as simple as
7675
possible.
77-
- [**Pip installation:**](#pip) Choose this installation if you want to use peptdeep as a Python package in an existing Python (recommended Python 3.8 or 3.9) environment (e.g. a Jupyter notebook). If needed, the GUI and CLI
76+
- [**Pip installation:**](#pip-installation) Choose this installation if you want to use peptdeep as a Python package in an existing Python (recommended Python 3.8 or 3.9) environment (e.g. a Jupyter notebook). If needed, the GUI and CLI
7877
can be installed with pip as well.
79-
- [**Developer installation:**](#developer) Choose this installation if you
78+
- [**Developer installation:**](#developer-installation) Choose this installation if you
8079
are familiar with CLI tools, [conda](https://docs.conda.io/en/latest/)
8180
and Python. This installation allows access to all available features
8281
of peptdeep and even allows to modify its source code directly.
8382
Generally, the developer version of peptdeep outperforms the
8483
precompiled versions which makes this the installation of choice for
8584
high-throughput experiments.
85+
- [**Docker installation**](#docker-installation) Choose this installation if you want to use peptdeep without any changes to your system.
8686

8787
### One-click GUI installation
8888

@@ -111,7 +111,7 @@ In newer MacOS versions, additional steps are required to enable installation of
111111
This is indicated by a dialog telling you `“peptdeep. ... .pkg” Not Opened`.
112112
1. Close this dialog by clicking `Done`.
113113
2. Choose `Apple menu` > `System Settings`, then `Privacy & Security` in the sidebar. (You may need to scroll down.)
114-
3. Go to `Security`, locate the line "alphadia.pkg was blocked to protect your Mac" then click `Open Anyway`.
114+
3. Go to `Security`, locate the line "peptdeep.pkg was blocked to protect your Mac" then click `Open Anyway`.
115115
4. In the dialog windows, click `Open Anyway`.
116116

117117

@@ -197,13 +197,45 @@ By default this installs 'loose' dependencies (no pinned versions),
197197
although it is also possible to use stable dependencies
198198
(e.g. `pip install -e ".[stable,development-stable]"`).
199199

200-
***By using the editable flag `-e`, all modifications to the [peptdeep
200+
By using the editable flag `-e`, all modifications to the [peptdeep
201201
source code folder](peptdeep) are directly reflected when running
202202
peptdeep. Note that the peptdeep folder cannot be moved and/or renamed
203203
if an editable version is installed. In case of confusion, you can
204204
always retrieve the location of any Python module with e.g. the command
205-
`import module` followed by `module.__file__`.***
205+
`import module` followed by `module.__file__`.
206+
207+
### Docker installation
208+
The containerized version can be used to run peptdeep without any installation to your system.
209+
210+
#### 1. Setting up Docker
211+
Install the latest version of docker (https://docs.docker.com/engine/install/).
212+
213+
#### 2. Prepare folder structure
214+
Set up your data to match the expected folder structure:
215+
create a folder and store its name in a variable, and specify a port
216+
```
217+
DATA_FOLDER=/home/username/data; mkdir -p $DATA_FOLDER
218+
PORT=8501
219+
```
206220

221+
#### 3. Start the container
222+
```bash
223+
docker run -v $DATA_FOLDER:/app/data -p $PORT:8501 mannlabs/peptdeep:latest
224+
```
225+
After initial download of the container, peptdeep will start running immediately,
226+
and can be accessed under [localhost:$PORT](http://localhost:8501).
227+
228+
Note: in the app, the local `$DATA_FOLDER` needs to be referred to as "`/app/data`".
229+
230+
#### Alternatively: Build the image yourself
231+
If you want to build the image yourself, you can do so by
232+
```bash
233+
docker build -t peptdeep .
234+
```
235+
and run it with
236+
```bash
237+
docker run -p $PORT:8501 -v $DATA_FOLDER:/app/data -t peptdeep
238+
```
207239

208240
### Enable GPU support
209241

pyproject.toml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ readme = "README.md"
1515
keywords = [
1616
"mass spectrometry",
1717
"proteomics",
18-
"search engine",
19-
"DIA",
20-
"data-independent acquisition",
2118
"bioinformatics",
2219
"AlphaPept",
2320
"AlphaPept ecosystem",
2421
"deep learning",
25-
"AlphaX ecosystem",
22+
"alphapept.org",
2623
]
2724
license = {file = "LICENSE.txt"}
2825
classifiers = [
@@ -38,14 +35,13 @@ classifiers = [
3835

3936
[project.urls]
4037

41-
"Paper preprint" = "https://www.biochem.mpg.de/mann"
42-
Repository = "https://github.com/MannLabs/peptdeep"
43-
#Documentation = "https://readthedocs.org"
44-
#Changelog = "https://github.com/me/spam/blob/master/CHANGELOG.md"
45-
Issues = "https://github.com/MannLabs/peptdeep/issues"
38+
repository = "https://github.com/MannLabs/peptdeep"
39+
issues = "https://github.com/MannLabs/peptdeep/issues"
40+
download = "https://mannlabs.github.io/peptdeep/releases"
41+
homepage = "https://www.alphapept.org"
4642
"Mann Labs Homepage" = "https://www.biochem.mpg.de/mann"
47-
Docs = "https://alphapeptdeep.readthedocs.io/en/latest/"
48-
PyPi = "https://pypi.org/project/peptdeep/"
43+
publication = "https://doi.org/10.1038/s41467-022-34904-3"
44+
documentation = "https://alphapeptdeep.readthedocs.io/en/latest/"
4945

5046
[tool.setuptools.packages]
5147
find = {}

0 commit comments

Comments
 (0)