diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8d183ec --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: Python application + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - + name: Build docker image without pushing it + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: false + tags: scraper:latest + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8d16b46 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.9-slim + +COPY . /src + +WORKDIR /src + +RUN pip install -r requirements.txt + +ENTRYPOINT ["python", "scraper.py"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a238121..b80a125 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,4 +10,17 @@ services: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: movie_db + # Initialize the database using create_table.sql + volumes: + - ./create_table.sql:/docker-entrypoint-initdb.d/create_table.sql + restart: unless-stopped + scraper: + build: . + depends_on: + - db + environment: + DB_HOST: db + DB_USER: postgres + DB_PASSWORD: postgres + DB_NAME: movie_db restart: unless-stopped \ No newline at end of file