-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from shenxianpeng/support-docker-image
feat: support docker image
- Loading branch information
Showing
5 changed files
with
84 additions
and
1 deletion.
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
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,30 @@ | ||
name: Publish Image | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'Dockerfile' | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Which tag want to build' | ||
default: '' | ||
required: false | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build to check Dockerfile | ||
if: github.event.inputs.tag == '' | ||
run: make image | ||
- name: Build and publish docker image | ||
if: github.event.inputs.tag != '' | ||
run: | | ||
echo "tag = ${{ github.event.inputs.tag }}" | ||
make image TAG=${{ github.event.inputs.tag }} | ||
echo $CR_PAT | docker login ghcr.io -u shenxianpeng --password-stdin | ||
make publish-image TAG=${{ github.event.inputs.tag }} | ||
env: | ||
CR_PAT: ${{ secrets.CR_PAT }} |
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
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,27 @@ | ||
FROM python:3.13-slim | ||
|
||
ARG VERSION | ||
|
||
# Install git and clean up unnecessary files to reduce image size | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN if [ -z "$VERSION" ]; then \ | ||
pip3 install git+https://github.com/shenxianpeng/gitstats.git@main; \ | ||
else \ | ||
pip3 install git+https://github.com/shenxianpeng/gitstats.git@$VERSION; \ | ||
fi | ||
|
||
USER nobody | ||
|
||
ENTRYPOINT [ "gitstats"] | ||
|
||
LABEL com.github.actions.name="Git Stats" | ||
LABEL com.github.actions.description="Check commit message formatting, branch naming, commit author, email, and more." | ||
LABEL com.github.actions.icon="code" | ||
LABEL com.github.actions.color="gray-dark" | ||
|
||
LABEL repository="https://github.com/shenxianpeng/git" | ||
LABEL maintainer="shenxianpeng <20297606+shenxianpeng@users.noreply.github.com>" |
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