-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate to poetry, release to ghcr only
- Loading branch information
1 parent
1434faa
commit d3e5d06
Showing
9 changed files
with
1,681 additions
and
1,417 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,82 @@ | ||
name: Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "*.*.*" | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
dockerhub: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# this writes the tag name into GIT_TAG_NAME | ||
- name: Get tag name | ||
uses: little-core-labs/[email protected] | ||
|
||
# https://github.com/docker/setup-qemu-action | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
# https://github.com/docker/setup-buildx-action | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
#with: | ||
# install: true | ||
|
||
- name: Inspect builder | ||
run: | | ||
echo "Name: ${{ steps.buildx.outputs.name }}" | ||
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | ||
echo "Status: ${{ steps.buildx.outputs.status }}" | ||
echo "Flags: ${{ steps.buildx.outputs.flags }}" | ||
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | ||
- name: Figure out release tag | ||
id: prep | ||
run: | | ||
if [ $GITHUB_REF_TYPE == "tag" ]; then | ||
RELEASE_VERSION=${GITHUB_REF_NAME#*/} | ||
else | ||
RELEASE_VERSION='latest' | ||
fi | ||
echo ::set-output name=version::${RELEASE_VERSION} | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=${{ steps.prep.outputs.version }},enable=${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
# linux/arm64 doesn't currently work because cffi doesn't want to build :( | ||
platforms: linux/amd64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -1,19 +1,35 @@ | ||
FROM python:3.11-slim-buster | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
ENV POETRY_VERSION="1.4.0" | ||
ENV PIP_DISABLE_PIP_VERSION_CHECK=on | ||
ENV VENV_HOME=/opt/poetry | ||
WORKDIR /app | ||
|
||
#RUN apt-get update \ | ||
#&& apt-get -y upgrade \ | ||
#&& apt-get -y install \ | ||
# git \ | ||
# gcc \ | ||
# python3-levenshtein | ||
|
||
COPY poetry.lock pyproject.toml ./ | ||
RUN apt-get update \ | ||
&& apt-get -y upgrade \ | ||
&& apt-get -y install \ | ||
git \ | ||
gcc \ | ||
python3-levenshtein | ||
&& apt-get -y install python3-pip \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* \ | ||
&& python3 -m venv ${VENV_HOME} \ | ||
&& ${VENV_HOME}/bin/pip install --upgrade pip \ | ||
&& ${VENV_HOME}/bin/pip install "poetry==${POETRY_VERSION}" \ | ||
&& ${VENV_HOME}/bin/poetry check \ | ||
&& POETRY_VIRTUALENVS_CREATE=false ${VENV_HOME}/bin/poetry install --no-interaction --no-cache --only main \ | ||
&& ${VENV_HOME}/bin/pip uninstall -y poetry | ||
|
||
WORKDIR /app | ||
# Add Poetry to PATH | ||
ENV PATH="${VENV_HOME}/bin:${PATH}" | ||
|
||
COPY . . | ||
COPY keel_telegram_bot keel_telegram_bot | ||
COPY README.md README.md | ||
|
||
RUN pip install --upgrade pip | ||
RUN pip install pipenv | ||
RUN pipenv install --system --deploy | ||
RUN pip install . | ||
RUN ${VENV_HOME}/bin/pip install . | ||
|
||
CMD [ "python", "./keel_telegram_bot/main.py" ] | ||
ENTRYPOINT [ "keel-telegram-bot" ] |
Oops, something went wrong.