Skip to content

Commit

Permalink
Simpler Dockerfile and action
Browse files Browse the repository at this point in the history
  • Loading branch information
pgoslatara committed Jul 18, 2024
1 parent 4a9e46e commit 20a4872
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 48 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Run action
uses: ./
with:
dbt-artifacts-dir: dbt_project/target


pex-tests:
needs: [pre-commit]
runs-on: ubuntu-latest
Expand Down
45 changes: 2 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,6 @@
# Keep in sync with .python-version
FROM python:3.11.5-alpine as base
FROM python:3.11.5-slim

# https://python-poetry.org/docs#ci-recommendations
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
POETRY_VERSION=1.7.1 \
POETRY_HOME=/opt/poetry \
POETRY_VENV=/opt/poetry-venv \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_VIRTUALENVS_IN_PROJECT=true


FROM base as builder

# # Install OS dependencies
RUN apk add --update curl && \
rm -rf /var/cache/apk/*

# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 - --version ${POETRY_VERSION}

# Add Poetry to PATH
ENV PATH="${PATH}:$POETRY_HOME/bin"

# Copy Dependencies
COPY poetry.lock pyproject.toml README.md ./
COPY dbt_bouncer ./dbt_bouncer

# Install Dependencies
RUN poetry install --no-cache --no-interaction --without dev \
&& rm -rf ~/.cache/pypoetry/artifacts


FROM base as dbt_bouncer

# Copy in pre-built .venv
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/local/lib /usr/local/lib

# Add dbt_bouncer to PATH
ENV PATH="${PATH}:${POETRY_VENV}/bin"

# Copy all remaining files
COPY dbt_bouncer ./dbt_bouncer
COPY dist/dbt-bouncer.pex dbt-bouncer.pex

CMD ["/bin/bash", "-c", "echo 'Expecting commands to be passed in.' && exit 1"]
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ runs:
using: 'composite'

steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
update-environment: false

- name: Run dbt-bouncer
shell: bash
run: |
Expand Down
Binary file modified dist/dbt-bouncer.pex
Binary file not shown.

0 comments on commit 20a4872

Please sign in to comment.