diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 793d8e0..947db7f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -7,12 +7,25 @@ on: branches: [ "master" ] jobs: - - build: - + build-and-push: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build the Docker image + run: | + docker build . \ + --file Dockerfile \ + --tag ${{ secrets.DOCKER_USERNAME }}/my-image-name:latest + + - name: Push Docker image to Docker Hub + run: | + docker push ${{ secrets.DOCKER_USERNAME }}/my-image-name:latest diff --git a/.gitignore b/.gitignore index 5577409..be5115f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ venv .env .vscode .pytest_cache -__pycache__ \ No newline at end of file +__pycache__ +.vscode/*.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 8f9631a..1889430 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,8 @@ "pycache", "pylint", "pytest", + "PYTHONUNBUFFERED", "venv" - ] + ], + "DockerRun.DisableDockerrc": true } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2c1c40b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM python:3.8-slim + +WORKDIR /app + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY pipmanager/requirements.txt . + +RUN pip install --no-cache-dir -r requirements.txt + +COPY pipmanager/* . + +RUN pip install --no-cache-dir . + +ENV PYTHONUNBUFFERED=1 + +CMD ["pipmanager", "--help"]