diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml new file mode 100644 index 0000000..af73c3e --- /dev/null +++ b/.github/workflows/publish-docker-image.yml @@ -0,0 +1,27 @@ +name: Publish Docker Image + +on: + workflow_dispatch: + push: + paths: + - 'requirements.txt' + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Log in to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build the Docker image + run: docker build -t ${{ secrets.DOCKER_USERNAME }}/test-workflows . + + - name: Push the Docker image + run: docker push ${{ secrets.DOCKER_USERNAME }}/test-workflows:latest diff --git a/DockerFile b/DockerFile new file mode 100644 index 0000000..cd92661 --- /dev/null +++ b/DockerFile @@ -0,0 +1,12 @@ +FROM ubuntu:latest as base + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* + +RUN pip3 install --upgrade pip + +COPY requirements.txt /app/requirements.txt + +RUN pip3 install -r /app/requirements.txt