From ab5d96f8195fed1afdae3790c909718fdcb9c2b8 Mon Sep 17 00:00:00 2001 From: iwatkot Date: Wed, 24 Jan 2024 01:08:02 +0300 Subject: [PATCH] Prepared for dockering. --- .dockerignore | 17 +++++++++++++++++ .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ Dockerfile | 9 +++++++++ build.sh | 5 +++++ 4 files changed, 57 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile create mode 100644 build.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f987b6d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +.git/ +.venv/ +.vscode/ +archives/ +cache/ +logs/ +output/ +previews/ +src/main.py +temp/ +.flake8 +.gitignore +LICENSE.md +README.md +requirements.txt +run.ps1 +run.sh \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..765ec8b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Docker Image CI + +on: + push: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: iwatkot/maps4fs:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2670413 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.12-slim + +WORKDIR /usr/src/app + +COPY . . + +RUN pip install -r bot_requirements.txt + +CMD ["python", "-u", "./src/main.py"] \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..029dc0f --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "Starting building Docker image..." +docker build --platform linux/amd64 -t iwatkot/maps4fs . +echo "Docker image has been successfully built, exiting..." \ No newline at end of file