-
Notifications
You must be signed in to change notification settings - Fork 130
Docker refactoring #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mec-iS
wants to merge
4
commits into
develop
Choose a base branch
from
docker-refactoring
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Docker refactoring #522
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| language: python | ||
| python: | ||
| - "3.6" | ||
| - "3.6-dev" # 3.6 development branch | ||
| - "3.7" | ||
| - "3.7-dev" # 3.7 development branch | ||
| install: | ||
| - pip install -r requirements.txt --no-cache | ||
| - pip install poetry | ||
| - poetry install --no-interaction --no-ansi | ||
| script: pytest | ||
| env: | ||
| - API_NAME=api PORT=8000 | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,19 +1,39 @@ | ||
| FROM tiangolo/uwsgi-nginx-flask:python3.7 | ||
| # maybe we want to move to: | ||
| # FROM tiangolo/meinheld-gunicorn-flask:python3.6 | ||
| FROM python:3.7.6-alpine3.11 as base | ||
|
|
||
| MAINTAINER Akshay Dahiya <xadahiya@gmail.com> | ||
| ENV PYTHONFAULTHANDLER=1 \ | ||
| PYTHONHASHSEED=random \ | ||
| PYTHONUNBUFFERED=1 | ||
|
|
||
| COPY ./requirements.txt requirements.txt | ||
| # install certificates which were not installed in the base image | ||
| RUN apt-get update && apt-get install -y ca-certificates | ||
| RUN pip install -U pip && pip install --upgrade pip setuptools \ | ||
| && pip install -r requirements.txt && rm -rf * | ||
| # | ||
| # building stage | ||
| # | ||
| FROM base as builder | ||
|
|
||
| COPY . /app | ||
| ENV PIP_DEFAULT_TIMEOUT=100 \ | ||
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
| PIP_NO_CACHE_DIR=1 \ | ||
| POETRY_VERSION=1.0.5 \ | ||
| PATH=/root/.local/bin:$PATH | ||
|
|
||
| ENV PYTHONPATH $PYTHONPATH:/app:/app/hydrus | ||
| RUN apk add --no-cache gcc libffi-dev musl-dev \ | ||
| py3-virtualenv git postgresql-dev \ | ||
| libxml2 libxml2-dev libxslt-dev | ||
|
|
||
| RUN mv /app/hydrus/uwsgi.ini /app/uwsgi.ini | ||
| COPY . ./app | ||
| WORKDIR /app | ||
| # Poetry requires a virtualenv | ||
| RUN pip install --user "poetry==$POETRY_VERSION" | ||
| RUN virtualenv -p $(which python) .venv | ||
| # Build wheels with Poetry | ||
| RUN poetry build && .venv/bin/pip install dist/*.whl | ||
|
|
||
| ENV MESSAGE "Hail Hydra" | ||
| # | ||
| # running stage | ||
| # | ||
| FROM base as final | ||
| RUN apk add --no-cache libffi libpq | ||
| # copy virtualenv and application | ||
| COPY --from=builder /app/.venv /.venv | ||
| COPY . ./app | ||
| WORKDIR /app | ||
| CMD ["/.venv/bin/gunicorn --bind 0.0.0.0:8080 --forwarded-allow-ips='*' hydrus:app"] |
This file contains hidden or 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
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the poetry docs, the recommended method to install poetry is not to use pip rather their own script