Skip to content

Commit

Permalink
Dockerize (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
spenserblack authored Sep 8, 2023
1 parent fe4fb70 commit 2448dcf
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docs/
scripts/
target/

*.md
CODEOWNERS
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ indent_size = 4
[*.{yaml,yml}]
indent_style = space
indent_size = 2

[Dockerfile]
indent_style = space
indent_size = 4
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,34 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: '*.tar.gz'

docker:
name: Publish Docker Image
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and Publish
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM rust:1-alpine3.18
WORKDIR app
COPY . .
RUN apk --update add cmake make musl-dev pkgconfig && \
cargo build --release && \
cp target/release/gengo /usr/local/bin/gengo && \
rm -rf target

ENTRYPOINT ["gengo"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,14 @@ templates/*.js gengo-language=Plain-Text

You will need to commit your `.gitattributes` file for it to take effect.

### Docker

You can build a docker image and run it as well.

```bash
docker build -t gengo .
docker run --rm -v $(pwd):$(pwd) -w $(pwd) -t gengo
```

[linguist]: https://github.com/github-linguist/linguist
[tokei]: https://github.com/xampprocky/tokei

0 comments on commit 2448dcf

Please sign in to comment.