Skip to content

Commit

Permalink
Add Dockerfile and Docker Push Workflow (#366)
Browse files Browse the repository at this point in the history
* Add docker container option

* fix: update Dockerfile for jinjafmt and workdir

* fix: update changelog

Co-authored-by: Yorick Smilda <[email protected]>
  • Loading branch information
tconbeer and Yorick Smilda authored Jan 20, 2023
1 parent 97e8d19 commit c89a23a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,19 @@ jobs:
LICENSE
dist/*sqlfmt*.whl
dist/*sqlfmt*.tar.gz
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:v${{ steps.sqlfmt_version.outputs.sqlfmt_version }}
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.0
3.10.6
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Features

- added a Dockerfile for running sqlfmt in a container. New versions of sqlfmt will include Docker builds pushed to the GitHub Container Registry (thank you [@ysmilda](https://github.com/ysmilda)!).

## [0.15.0] - 2023-01-18

### Formatting Changes + Bug Fixes
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3-slim

COPY dist/*.whl .
RUN pip install $(find . -name "*.whl")[jinjafmt]
RUN rm *.whl

RUN mkdir /src
WORKDIR /src

CMD ["sqlfmt", "."]

0 comments on commit c89a23a

Please sign in to comment.