From 0ff704372709b211b44fda1fe1a01644130beb69 Mon Sep 17 00:00:00 2001 From: boke0 Date: Tue, 9 Mar 2021 02:17:02 +0900 Subject: [PATCH] [update] --- .github/workflows/python-publish.yml | 24 ++++++++++++++++++------ Dockerfile | 13 +++++-------- Dockerfile.mysql | 15 ++++++--------- Dockerfile.postgresql | 15 ++++++--------- 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 8f50d18..ec9c079 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -8,7 +8,7 @@ on: types: [created] jobs: - deploy-pypi: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -19,15 +19,25 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install poetry poetry-dynamic-versioning twine - - name: Build package and publish + pip install poetry poetry-dynamic-versioning + - name: Build package + run: poetry build + deploy-pypi: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install twine + - name: Publish to PyPI env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - poetry build - twine upload dist/* + run: twine upload dist/* deploy-docker: + needs: build runs-on: ubuntu-latest steps: - name: Docker meta @@ -50,6 +60,7 @@ jobs: tags: mitamaorg/mitama:latest, ${{ steps.docker_meta.outputs.tags }} file: ./Dockerfile deploy-docker-mysql: + needs: build runs-on: ubuntu-latest steps: - name: Docker login @@ -72,6 +83,7 @@ jobs: tags: mitamaorg/mitama:latest-mysql, ${{ steps.docker_meta_mysql.outputs.tags }} file: ./Dockerfile.mysql deploy-docker-postgresql: + needs: build runs-on: ubuntu-latest steps: - name: Docker login diff --git a/Dockerfile b/Dockerfile index 73ec21f..e3ef27c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,11 @@ FROM alpine:3.13 -RUN mkdir /code -ADD ./mitama /code/mitama -ADD ./pyproject.toml /code/pyproject.toml -ADD ./.git /code/.git -WORKDIR /code +RUN mkdir /pkg +ADD /dist /pkg +WORKDIR /pkg RUN apk add --no-cache python3 python3-dev py3-pip libmagic nginx build-base gcc libffi-dev openssl-dev rust cargo zlib-dev jpeg-dev nginx postfix git \ && pip3 install --upgrade pip \ - && pip3 install uwsgi poetry wheel poetry-dynamic-versioning \ - && poetry config virtualenvs.create false \ - && poetry install --no-dev \ + && pip3 install uwsgi poetry \ + && pip3 install /pkg/* \ && apk del --purge zlib-dev gcc openssl-dev rust cargo python3-dev build-base libffi-dev RUN mkdir /conf RUN mkdir /log diff --git a/Dockerfile.mysql b/Dockerfile.mysql index 4e19488..50bdb17 100644 --- a/Dockerfile.mysql +++ b/Dockerfile.mysql @@ -1,14 +1,11 @@ FROM alpine:3.13 -RUN mkdir /code -ADD ./mitama /code/mitama -ADD ./pyproject.toml /code/pyproject.toml -ADD ./.git /code/.git -WORKDIR /code -RUN apk add --no-cache python3 python3-dev py3-pip libmagic nginx build-base gcc libffi-dev openssl-dev rust cargo zlib-dev jpeg-dev nginx postfix mariadb-dev mariadb-connector-c-dev\ +RUN mkdir /pkg +ADD /dist /pkg +WORKDIR /pkg +RUN apk add --no-cache python3 python3-dev py3-pip libmagic nginx build-base gcc libffi-dev openssl-dev rust cargo zlib-dev jpeg-dev nginx postfix mariadb-dev mariadb-connector-c-dev git \ && pip3 install --upgrade pip \ - && pip3 install uwsgi poetry mysqlclient wheel poetry-dynamic-versioning git \ - && poetry config virtualenvs.create false \ - && poetry install --no-dev \ + && pip3 install uwsgi poetry mysqlclient \ + && pip3 install /pkg/* \ && apk del --purge zlib-dev gcc openssl-dev rust cargo python3-dev build-base libffi-dev mariadb-dev RUN mkdir /conf RUN mkdir /log diff --git a/Dockerfile.postgresql b/Dockerfile.postgresql index b05af2d..12aabed 100644 --- a/Dockerfile.postgresql +++ b/Dockerfile.postgresql @@ -1,14 +1,11 @@ FROM alpine:3.13 -RUN mkdir /code -ADD ./mitama /code/mitama -ADD ./pyproject.toml /code/pyproject.toml -ADD ./.git /code/.git -WORKDIR /code -RUN apk add --no-cache python3 python3-dev py3-pip libmagic nginx build-base gcc libffi-dev openssl-dev rust cargo zlib-dev jpeg-dev nginx postfix postgresql-dev postgresql-libs git \ +RUN mkdir /pkg +ADD /dist /pkg +WORKDIR /pkg +RUN apk add --no-cache python3 python3-dev py3-pip libmagic nginx build-base gcc libffi-dev openssl-dev rust cargo zlib-dev jpeg-dev nginx postfix postgresql-dev postgresql-libs \ && pip3 install --upgrade pip \ - && pip3 install uwsgi poetry psycopg2 wheel poetry-dynamic-versioning \ - && poetry config virtualenvs.create false \ - && poetry install --no-dev \ + && pip3 install uwsgi poetry psycopg2 \ + && pip3 install /pkg/* \ && apk del --purge zlib-dev gcc openssl-dev rust cargo python3-dev build-base libffi-dev postgresql-dev RUN mkdir /conf RUN mkdir /log