Skip to content

Commit 179a4c1

Browse files
committed
feat(docker): add Dockerfile and .dockerignore for containerized setup
chore(lint): update GitHub Actions workflow to use Docker for linting and testing refactor(main.py): replace Authenticator instance with a placeholder string in InstagramBot class for testing purposes
1 parent 7b4e3b5 commit 179a4c1

File tree

4 files changed

+51
-16
lines changed

4 files changed

+51
-16
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.git
2+
__pycache__
3+
.venv
4+
tests
5+
*.pyc

.github/workflows/lint.yml

+17-13
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,25 @@ jobs:
99
- name: Checkout repository
1010
uses: actions/checkout@v4
1111

12-
- name: Set up Python
13-
uses: actions/setup-python@v4
12+
- name: Set up Docker Buildx
13+
uses: docker/setup-buildx-action@v2
14+
15+
- name: Cache Docker layers
16+
uses: actions/cache@v3
1417
with:
15-
python-version: "3.10"
18+
path: /tmp/.buildx-cache
19+
key: ${{ runner.os }}-buildx-${{ github.sha }}
20+
restore-keys: |
21+
${{ runner.os }}-buildx-
1622
17-
- name: Install Poetry
18-
uses: snok/install-poetry@v1
23+
- name: Build Docker image
24+
run: docker build -t focusfeed .
1925

20-
- name: Install dependencies
21-
run: |
22-
poetry install
23-
poetry add ruff --group dev
26+
- name: Run tests in Docker
27+
run: docker run focusfeed poetry run pytest tests/
2428

25-
- name: Run ruff format
26-
run: poetry run ruff format . --check
29+
- name: Format with Ruff
30+
run: docker run focusfeed poetry run ruff format . --check
2731

28-
- name: Run ruff lint
29-
run: poetry run ruff check .
32+
- name: Lint with Ruff
33+
run: docker run focusfeed poetry run ruff check .

Dockerfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use the official Python 3.10 image
2+
FROM python:3.10-slim
3+
4+
# Set environment variables
5+
ENV POETRY_VERSION=1.1.13
6+
ENV POETRY_HOME="/opt/poetry"
7+
ENV POETRY_VIRTUALENVS_CREATE=false
8+
9+
# Install Poetry
10+
RUN apt-get update && apt-get install -y curl && \
11+
curl -sSL https://install.python-poetry.org | python3 - && \
12+
ln -s $POETRY_HOME/bin/poetry /usr/local/bin/poetry
13+
14+
15+
# Set the working directory
16+
WORKDIR /app
17+
18+
# Copy the project files
19+
COPY . .
20+
21+
# Install dependencies
22+
RUN poetry install --no-dev
23+
24+
# Expose the port the app runs on
25+
EXPOSE 8000
26+
27+
# Set the entry point
28+
CMD ["poetry", "run", "focusfeed"]

focusfeed/main.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import sys
22

3-
from src.auth import Authenticator
4-
53

64
class InstagramBot:
75
def __init__(self):
8-
self.auth = Authenticator()
6+
self.auth = "Hello"
97
self.loader = None
108

119
def display_menu(self):

0 commit comments

Comments
 (0)