Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .deepsource.toml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build and Push Docker Image

on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# Virtual environment
.venv/
venv/
ENV/

# Environment variables
.env
*.env

# Alembic migration cache
alembic/versions/__pycache__/
alembic.ini

# Database files
*.sqlite3
*.db

# Docker
*.pid

# VSCode
.vscode/

# JetBrains
.idea/

# OS generated files
.DS_Store
Thumbs.db

# Logs
*.log

# Python egg
*.egg-info/

dist/
build/

# Coverage
.coverage
htmlcov/

# Lint/format
.mypy_cache/
.pytest_cache/

# Misc
*.bak
*.swp

# Ignore Alembic generated files except env.py and README
alembic/versions/*
!alembic/README
!alembic/env.py

32 changes: 14 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
FROM python:3
FROM python:3.12-slim

ENV PYTHONNUNBUFFERED 1
WORKDIR /app

ENV DISCORD_TOKEN YOUR_DISCORD_TOKEN
ENV DISCORD_GUILD YOUR_DISCORD_GUILD
ENV REDDIT_USER YOUR_REDDIT_USER
ENV REDDIT_PASSWORD YOUR_REDDIT_PASSWORD
ENV CLIENT_ID YOUR_CLIENT_ID
ENV CLIENT_SECRET YOUR_CLIENT_SECRET
ENV ADMIN_ROLE_ID YOUR_ADMIN_ROLE_ID
ENV CHANNEL_TO_POST_ID YOUR_CHANNEL_TO_POST_ID
ENV CHANNEL_LOGS_ID YOUR_CHANNEL_LOGS_ID
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /bot-code
WORKDIR /bot-code
ADD . /bot-code
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

RUN apt-get update
RUN pip install -r requirements.txt
COPY . .

ENV PYTHONUNBUFFERED=1

CMD ["python", "main.py"]

CMD ["main.py"]
ENTRYPOINT ["python3"]
31 changes: 0 additions & 31 deletions Dockerfile_EXAMPLE

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

14 changes: 0 additions & 14 deletions Makefile

This file was deleted.

18 changes: 0 additions & 18 deletions Pipfile

This file was deleted.

Loading