Skip to content

Commit fab85f7

Browse files
authored
Add docker image (koxudaxi#919)
* Add docker image * Add build-args * Fix build-args * Fix build-args
1 parent 59d713d commit fab85f7

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/workflows/publish.yml

+32
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,35 @@ jobs:
3434
with:
3535
user: __token__
3636
password: ${{ secrets.pypi_password }}
37+
push_to_registry:
38+
name: Push Docker image to Docker Hub
39+
if: "success() && startsWith(github.ref, 'refs/tags/')"
40+
runs-on: ubuntu-latest
41+
needs: build-n-publish
42+
steps:
43+
- name: Check out the repo
44+
uses: actions/checkout@v2
45+
- name: Docker meta
46+
id: docker_meta
47+
uses: crazy-max/ghaction-docker-meta@v1
48+
with:
49+
images: koxudaxi/datamodel-code-generator
50+
tag-semver: |
51+
{{raw}}
52+
- name: Login to DockerHub
53+
uses: docker/login-action@v1
54+
with:
55+
username: ${{ secrets.DOCKERHUB_USERNAME }}
56+
password: ${{ secrets.DOCKERHUB_TOKEN }}
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v1
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v1
61+
- name: Build and push
62+
uses: docker/build-push-action@v2
63+
with:
64+
push: true
65+
tags: ${{ steps.docker_meta.outputs.tags }}
66+
build-args: |
67+
VERSION=${{ steps.docker_meta.outputs.tags.0 }}
68+
platforms: linux/amd64,linux/arm64

Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.11.0-alpine3.16 as builder
2+
3+
LABEL maintainer="Koudai Aono <[email protected]>"
4+
5+
RUN apk add --no-cache gcc musl-dev
6+
7+
ARG VERSION
8+
9+
RUN pip install "datamodel-code-generator[http]==$VERSION"
10+
11+
ENTRYPOINT ["datamodel-codegen"]

0 commit comments

Comments
 (0)