Skip to content

Commit

Permalink
fix: update Dockerfile and update ci-cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MountainGod2 committed Aug 9, 2024
1 parent 8b7951e commit 4529c59
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,8 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/mountaingod2/chaturbate_poller
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
Expand Down Expand Up @@ -175,3 +173,7 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Run tests on Docker image
run: |
docker run --rm ghcr.io/mountaingod2/chaturbate_poller:latest --version
27 changes: 26 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim as builder

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Create a virtual environment in /venv
RUN python -m venv /venv

# Activate virtual environment and upgrade pip
ENV PATH="/venv/bin:$PATH"
RUN pip install --upgrade pip

# Install the latest version of the chaturbate-poller package
RUN pip install --no-cache-dir chaturbate-poller

# Create a new stage for the final image
FROM python:3.11-slim

RUN pip install --no-cache-dir --no-compile chaturbate-poller
# Copy the virtual environment from the builder stage
COPY --from=builder /venv /venv

# Set the path to use the virtual environment
ENV PATH="/venv/bin:$PATH"

# Set working directory
WORKDIR /app

# Command to run the application
ENTRYPOINT ["python", "-m", "chaturbate_poller"]

0 comments on commit 4529c59

Please sign in to comment.