From e00f7b07be61d337f598c44ce45fea1306ef10f6 Mon Sep 17 00:00:00 2001 From: doteq Date: Fri, 2 Dec 2022 22:32:55 +0100 Subject: [PATCH] Add deploy config (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: MikoĊ‚aj Pich --- .github/workflows/deploy.yml | 24 ++++++++++++++++++++++++ Dockerfile | 14 ++++++++++++++ docker-compose.yaml | 4 ++++ 3 files changed, 42 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..63d75c6 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,24 @@ +name: Deploy to Oracle Cloud + +on: + push: + branches: [ master ] + +jobs: + deploy: + runs-on: ubuntu-latest + environment: oracle-cloud + steps: + - uses: actions/checkout@v2 + - name: Create .env file + uses: SpicyPizza/create-envfile@v1 + with: + envkey_API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }} + envkey_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} + - uses: alex-ac/github-action-ssh-docker-compose@master + name: Docker-Compose Remote Deployment + with: + ssh_host: ${{ secrets.CLOUD_SSH_HOST }} + ssh_private_key: ${{ secrets.CLOUD_SSH_PRIVATE_KEY }} + ssh_user: ${{ secrets.CLOUD_SSH_USER }} + docker_compose_prefix: bot \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c51fd99 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.11-alpine + +ENV POETRY_VERSION=1.2.0 +ENV PYTHONUNBUFFERED=1 + +RUN apk add gcc libressl-dev libffi-dev python3-dev musl-dev +RUN pip install "poetry==$POETRY_VERSION" +WORKDIR /app +COPY poetry.lock pyproject.toml /app/ + +RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root + +COPY . . +CMD [ "poetry", "run", "python", "-m", "wulkabot" ] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..15ca96d --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,4 @@ +version: "3.5" +services: + bot: + build: . \ No newline at end of file