Skip to content

Commit

Permalink
Refactor CI pipeline to use separate Dockerfiles for linting, testing…
Browse files Browse the repository at this point in the history
…, and publishing with Alpine 3.20 and virtualenv setup
  • Loading branch information
abbastoof committed Jul 8, 2024
1 parent 026dda6 commit efce85e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 28 deletions.
13 changes: 3 additions & 10 deletions Dockerfile.lint
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
FROM alpine:3.20

# Install Python and pip
RUN apk add --no-cache python3 py3-pip && \
python3 -m ensurepip && \
ln -sf python3 /usr/bin/python && \
pip install --upgrade pip && \
pip install virtualenv
RUN apk add --no-cache python3 py3-pip

# Create and activate virtual environment
RUN python3 -m venv /venv

# Ensure setuptools and wheel are installed in virtual environments before installing requirements
RUN /venv/bin/pip install --upgrade setuptools wheel

# Copy requirements and install within virtual environment
COPY ./requirements.txt /requirements.txt
RUN /venv/bin/pip install -r /requirements.txt
RUN /venv/bin/pip install flake8
RUN /venv/bin/pip install --no-cache-dir -r /requirements.txt
RUN /venv/bin/pip install --no-cache-dir flake8

WORKDIR /app

Expand Down
11 changes: 2 additions & 9 deletions Dockerfile.publish
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
FROM alpine:3.20

# Install Python and pip
RUN apk add --no-cache python3 py3-pip && \
python3 -m ensurepip && \
ln -sf python3 /usr/bin/python && \
pip install --upgrade pip && \
pip install virtualenv
RUN apk add --no-cache python3 py3-pip

# Create and activate virtual environment
RUN python3 -m venv /venv

# Ensure setuptools and wheel are installed in virtual environments before installing requirements
RUN /venv/bin/pip install --upgrade setuptools wheel

# Copy requirements and install within virtual environment
COPY ./requirements.txt /requirements.txt
RUN /venv/bin/pip install -r /requirements.txt
RUN /venv/bin/pip install --no-cache-dir -r /requirements.txt

WORKDIR /app

Expand Down
11 changes: 2 additions & 9 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
FROM alpine:3.20

# Install Python and pip
RUN apk add --no-cache python3 py3-pip && \
python3 -m ensurepip && \
ln -sf python3 /usr/bin/python && \
pip install --upgrade pip && \
pip install virtualenv
RUN apk add --no-cache python3 py3-pip

# Create and activate virtual environment
RUN python3 -m venv /venv

# Ensure setuptools and wheel are installed in virtual environments before installing requirements
RUN /venv/bin/pip install --upgrade setuptools wheel

# Copy requirements and install within virtual environment
COPY ./requirements.txt /requirements.txt
RUN /venv/bin/pip install -r /requirements.txt
RUN /venv/bin/pip install --no-cache-dir -r /requirements.txt

WORKDIR /app

Expand Down

0 comments on commit efce85e

Please sign in to comment.