-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80d2017
commit 5f14a9b
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# create image to export requirements | ||
FROM python:3.11-slim AS poetry | ||
|
||
# build dependencies | ||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
build-essential \ | ||
gcc \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# install poetry | ||
RUN python -m pip install --no-cache-dir --upgrade poetry==1.8.2 | ||
|
||
# copy dependencies | ||
COPY poetry.lock pyproject.toml ./ | ||
|
||
# create a requirements file | ||
RUN poetry export -f requirements.txt --without-hashes -o /tmp/requirements.txt | ||
|
||
|
||
# create batch search image | ||
FROM python:3.11-slim as batch-search | ||
|
||
ENV \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
HOME="/srv/rfam-batch-search" | ||
|
||
# create folders and set work directory | ||
RUN mkdir -p $HOME && mkdir /var/log/gunicorn | ||
WORKDIR $HOME | ||
|
||
# install requirements | ||
COPY --from=poetry /tmp/requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# copy project | ||
COPY . . | ||
|
||
EXPOSE 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: '3' | ||
|
||
services: | ||
# FastAPI | ||
web: | ||
build: . | ||
command: gunicorn -c gunicorn/gunicorn_conf.py -b 0.0.0.0:8000 main:app | ||
ports: | ||
- "8000:8000" | ||
networks: | ||
- nginx-network | ||
|
||
# Nginx server | ||
nginx: | ||
image: nginx:1.26.0-alpine | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- ./nginx/conf.d:/etc/nginx/conf.d | ||
depends_on: | ||
- web | ||
networks: | ||
- nginx-network | ||
|
||
networks: | ||
nginx-network: | ||
driver: bridge |