From b99496c3e4d12354a243504cbddf03393d65932c Mon Sep 17 00:00:00 2001 From: Ereiarrus Date: Wed, 31 Jan 2024 01:13:05 +0000 Subject: [PATCH] removing custom action - doing everything for it in container --- .github/actions/python-init/action.yml | 25 ------------------------- .github/workflows/python-app.yml | 7 ++++--- Dockerfile | 9 +-------- docker_run.sh | 8 +------- 4 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 .github/actions/python-init/action.yml diff --git a/.github/actions/python-init/action.yml b/.github/actions/python-init/action.yml deleted file mode 100644 index e96e0a3..0000000 --- a/.github/actions/python-init/action.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: python-env-init -description: Initialises a Python environment - - -inputs: - secrets: - required: true - description: a JSON object of all GitHub secrets - -runs: - using: 'composite' - steps: - - uses: oNaiPs/secrets-to-env-action@v1 # exports all github secrets as env variables (when used with the next 2 lines) - with: - secrets: ${{ inputs.secrets }} - -# - name: Set up Python 3.12 -# uses: actions/setup-python@v3 -# with: -# python-version: "3.12" -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# if [ -f src/requirements.txt ]; then pip install -r src/requirements.txt; fi -# shell: bash diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index adc8e15..5e47d67 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/python-init + - uses: oNaiPs/secrets-to-env-action@v1 with: secrets: ${{ toJSON(secrets) }} @@ -42,7 +42,7 @@ jobs: needs: [build] steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/python-init + - uses: oNaiPs/secrets-to-env-action@v1 with: secrets: ${{ toJSON(secrets) }} @@ -71,7 +71,7 @@ jobs: if: github.ref == 'refs/heads/main' # Only deploy if this was a push to main steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/python-init + - uses: oNaiPs/secrets-to-env-action@v1 with: secrets: ${{ toJSON(secrets) }} @@ -101,4 +101,5 @@ jobs: chmod +x ./docker_build.sh chmod +x ./docker_run.sh + chmod +x ./restart_24.sh ./docker_run.sh diff --git a/Dockerfile b/Dockerfile index a1b3009..62b4a42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ ENV PYTHONPATH /complements-bot-py COPY src ./src COPY main.py . RUN rm -rf ./src/test_complements_bot +RUN rm -rf ./src/test_app RUN pip install pipenv RUN apk update RUN apk add gcc @@ -18,14 +19,6 @@ RUN apk add build-base RUN cd ./src; pipenv install --system --deploy; cd .. RUN rm -rf /var/cache/apk/* RUN pip install cython - -RUN find /usr -name Python.h - -RUN python3-config --includes -RUN python3-config --includes | grep python3.12 - RUN python -m cython -3 --embed -o main.c main.py RUN gcc -Os -I $(python3-config --includes | grep python3.12) -o main main.c -lpython3.12 -lpthread -lutil $(python3-config --libs) -# EXPOSE 50994/tcp -# EXPOSE 50995/tcp CMD ["./main"] diff --git a/docker_run.sh b/docker_run.sh index 0ead5ae..9a838ed 100644 --- a/docker_run.sh +++ b/docker_run.sh @@ -1,12 +1,6 @@ #!/bin/bash -#restarter_kill_status="$?" -#if [ "$restarter_kill_status" != 0 ]; then -# >&2 echo "error on killing restarter script" -# exit "$restarter_kill_status" -#fi - old_container_id="$(./docker_build.sh)" build_status="$?" if [ "$build_status" != 0 ]; then @@ -38,4 +32,4 @@ if [ "$run_status" != 0 ]; then exit "$run_status" fi -nohup ./restart_24.sh "$container_id" 1>&2 2>/restart.log & +nohup ./restart_24.sh "$container_id" 1>&2 2>./restart.log &