This repository has been archived by the owner on Jul 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:fvalverd/AutoApi
- Loading branch information
Showing
20 changed files
with
263 additions
and
142 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,30 @@ | ||
name: docker | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Push to Docker Hub | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
repository: ${{ secrets.DOCKER_USERNAME }}/autoapi | ||
tag_with_ref: true | ||
push: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
target: runtime-autoapi | ||
- name: Push to GitHub Packages | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
registry: docker.pkg.github.com | ||
repository: ${{ github.actor }}/autoapi/autoapi | ||
push: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
tag_with_ref: true | ||
target: runtime-autoapi |
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
name: pypi | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U -r requirements-tools.txt | ||
python -m pip install twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
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
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
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,92 @@ | ||
############### | ||
# Base Python # | ||
############### | ||
FROM python:3.8-slim-buster AS base-autoapi | ||
|
||
# Virtualenv PATH | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
|
||
###################### | ||
# Base testing image # | ||
###################### | ||
FROM base-autoapi AS base-testing-autoapi | ||
|
||
RUN apt update --quiet 3 > /dev/null 2>&1 && \ | ||
apt install --no-install-recommends --yes --quiet 3 gnupg curl > /dev/null 2>&1 && \ | ||
curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - > /dev/null 2>&1 && \ | ||
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" > /etc/apt/sources.list.d/mongodb-org-4.2.list && \ | ||
apt update --quiet 3 > /dev/null 2>&1 && \ | ||
apt install --no-install-recommends --yes --quiet 3 mongodb-org-server=4.2.6 > /dev/null 2>&1 | ||
|
||
|
||
################# | ||
# Builder image # | ||
################# | ||
FROM base-autoapi AS builder-autoapi | ||
|
||
WORKDIR /app | ||
|
||
# Create Virtualenv | ||
RUN python -m venv /opt/venv | ||
|
||
# Upgrade python tools | ||
COPY requirements-tools.txt ./ | ||
RUN pip install --quiet --upgrade --requirement requirements-tools.txt | ||
|
||
# Install python dependencies | ||
COPY requirements.txt ./ | ||
RUN pip install --quiet --requirement requirements.txt | ||
|
||
# Install AutoApi | ||
COPY auto_api ./auto_api | ||
COPY LICENSE setup.py setup.cfg ./ | ||
RUN pip install --quiet --no-dependencies . | ||
|
||
|
||
################# | ||
# Testing image # | ||
################# | ||
FROM base-testing-autoapi AS testing-autoapi | ||
|
||
WORKDIR /app | ||
|
||
# Installed python modules | ||
COPY --from=builder-autoapi /opt/venv /opt/venv | ||
|
||
# Install python dev dependencies | ||
COPY requirements-dev.txt ./ | ||
RUN pip install --quiet --requirement requirements-dev.txt | ||
|
||
# Run tests | ||
COPY tests ./tests | ||
COPY run_tests.py ./ | ||
RUN python run_tests.py | ||
|
||
|
||
#################### | ||
# Production image # | ||
#################### | ||
FROM base-autoapi AS runtime-autoapi | ||
|
||
# Installed python modules | ||
COPY --from=builder-autoapi /opt/venv /opt/venv | ||
|
||
# AutoApi user | ||
ARG user=app | ||
RUN useradd --create-home $user | ||
|
||
# AutoApi port | ||
ARG port=8686 | ||
ENV PORT=$port | ||
EXPOSE $port | ||
|
||
# AutoApi entrypoint | ||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# Setup service | ||
USER $user | ||
WORKDIR /home/$user | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["--bind :", "echo $PORT"] |
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
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
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
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
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
Oops, something went wrong.