From cc9df870a1c7cd0a8b2e54a32a8d673a3104d225 Mon Sep 17 00:00:00 2001 From: remi Date: Thu, 2 Jan 2025 16:51:50 -0500 Subject: [PATCH] devops --- .gitea/workflows/build.yaml | 47 +++++++++++++++++++++++++++++++++++++ .gitignore | 1 + DOCKERFILE => Dockerfile | 15 +++++++----- requirements.txt | 6 +++++ 4 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/build.yaml rename DOCKERFILE => Dockerfile (62%) create mode 100644 requirements.txt diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..6e762a8 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,47 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/my-image:latest + + push_to_gitea: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Push to Gitea + env: + GITEA_SERVER: ${{ secrets.ADDRESS_GITEA_SERVER }} + GITEA_TOKEN: ${{ secrets.REPO_GITEA_TOKEN }} + run: | + docker tag ${{ secrets.DOCKER_USERNAME }}/my-image:latest ${GITEA_SERVER}/my-repo/my-image:latest + docker push ${GITEA_SERVER}/my-repo/my-image:latest diff --git a/.gitignore b/.gitignore index 2f38721..bb0bfe3 100644 --- a/.gitignore +++ b/.gitignore @@ -133,6 +133,7 @@ venv/ ENV/ env.bak/ venv.bak/ +cal_env/ # Spyder project settings .spyderproject diff --git a/DOCKERFILE b/Dockerfile similarity index 62% rename from DOCKERFILE rename to Dockerfile index 4c36802..2c94fd0 100644 --- a/DOCKERFILE +++ b/Dockerfile @@ -4,15 +4,18 @@ FROM python:3.9-slim # Set the working directory in the container WORKDIR /app -# Copy the requirements file into the container -COPY requirements.txt /app/requirements.txt +# Install pip-chill +RUN pip install --no-cache-dir pip-chill -# Install the required packages -RUN pip install --no-cache-dir -r requirements.txt - -# Copy the rest of the application code into the container +# Copy the application code into the container COPY . /app +# Generate requirements.txt with pip-chill +RUN pip-chill > requirements.txt + +# Install the required packages based on the newly created requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + # Create a directory for the configuration files RUN mkdir /config diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c4ce7db --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +calmap==0.0.11 +datetime==5.5 +pip-chill==1.0.3 +plotly==5.24.1 +streamlit==1.41.1 +vobject==0.9.9