-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding workflow to save as Docker image
- Loading branch information
1 parent
4770a87
commit ef30a01
Showing
4 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
name: CD pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
cd_pipeline: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
dbt-bouncer | ||
tags: | | ||
type=ref,event=branch | ||
type=raw,value=${{ github.sha }} | ||
type=raw,value=test | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: https://ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Determine python version | ||
id: python-version | ||
run: | | ||
export PYTHON_VERSION=$(cat .python-version) | ||
echo "PYTHON_VERSION: $PYTHON_VERSION" | ||
echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_OUTPUT | ||
- name: Build image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: PYTHON_VERSION=${{ steps.python-version.outputs.PYTHON_VERSION }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
context: . | ||
load: false | ||
push: false | ||
tags: ${{ steps.meta.outputs.tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
ARG PYTHON_VERSION | ||
FROM python:${PYTHON_VERSION}-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 | ||
|
||
# Creating a virtual environment just for poetry and install it with pip | ||
RUN python3 -m venv $POETRY_VENV \ | ||
&& $POETRY_VENV/bin/pip install --no-cache-dir -U pip setuptools \ | ||
&& $POETRY_VENV/bin/pip install --no-cache-dir poetry==${POETRY_VERSION} | ||
|
||
# Add Poetry to PATH | ||
ENV PATH="${PATH}:${POETRY_VENV}/bin" | ||
|
||
WORKDIR /app | ||
|
||
# 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 | ||
|
||
CMD ["/bin/bash", "-c", "echo 'Expecting commands to be passed in.' && exit 1"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters