Skip to content

Commit 64097cf

Browse files
committed
build and push docker image
1 parent 7fc9d63 commit 64097cf

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,78 @@ jobs:
5353
run: make upload-to-pypi
5454
env:
5555
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
56+
57+
push_to_docker_hub:
58+
name: "Push To Docker Hub"
59+
needs: run_checks
60+
runs-on: "ubuntu-latest"
61+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
62+
steps:
63+
- uses: actions/checkout@v2
64+
65+
- name: Set Up Docker Buildx
66+
id: buildx
67+
uses: docker/setup-buildx-action@v1
68+
69+
- name: Build the image
70+
run: make docker-image
71+
72+
- name: Login To DockerHub
73+
uses: docker/login-action@v1
74+
with:
75+
username: ${{ secrets.DOCKERHUB_USERNAME }}
76+
password: ${{ secrets.DOCKERHUB_TOKEN }}
77+
78+
- name: Docker Meta
79+
id: docker_meta
80+
uses: docker/metadata-action@v3
81+
with:
82+
images: enapter/python-sdk
83+
tags: |
84+
type=raw,value=${{ github.ref_name }}
85+
86+
- name: Build And Push To DockerHub
87+
uses: docker/build-push-action@v2
88+
with:
89+
context: .
90+
push: true
91+
tags: ${{ steps.docker_meta.outputs.tags }}
92+
labels: ${{ steps.docker_meta.outputs.labels }}
93+
94+
push_to_enapter_docker_hub:
95+
name: "Push To Enapter Docker Hub"
96+
needs: run_checks
97+
runs-on: "ubuntu-latest"
98+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
99+
steps:
100+
- uses: actions/checkout@v2
101+
102+
- name: Set Up Docker Buildx
103+
id: buildx
104+
uses: docker/setup-buildx-action@v1
105+
106+
- name: Build The Image
107+
run: make docker-image
108+
109+
- name: Login To DockerHub
110+
uses: docker/login-action@v1
111+
with:
112+
registry: docker.enapter.com
113+
username: ${{ secrets.ENAPTER_DOCKERHUB_USERNAME }}
114+
password: ${{ secrets.ENAPTER_DOCKERHUB_TOKEN }}
115+
116+
- name: Docker Meta
117+
id: enapter_docker_meta
118+
uses: docker/metadata-action@v3
119+
with:
120+
images: docker.enapter.com/python/sdk
121+
tags: |
122+
type=raw,value=${{ github.ref_name }}
123+
124+
- name: Build And Push To DockerHub
125+
uses: docker/build-push-action@v2
126+
with:
127+
context: .
128+
push: true
129+
tags: ${{ steps.enapter_docker_meta.outputs.tags }}
130+
labels: ${{ steps.enapter_docker_meta.outputs.labels }}

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.14
2+
3+
WORKDIR /app
4+
5+
ADD README.md README.md
6+
ADD setup.py setup.py
7+
ADD src src
8+
9+
RUN pip install . && rm README.md && rm setup.py && rm -rf src
10+
11+
STOPSIGNAL SIGINT
12+
13+
ENTRYPOINT ["python", "-m", "enapter"]

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,9 @@ endif
7575

7676
grep -E --files-with-matches --recursive 'enapter==[0-9]+.[0-9]+.[0-9]+' README.md examples \
7777
| xargs -n 1 sed -E -i 's/enapter==[0-9]+.[0-9]+.[0-9]+/enapter==$(V)/g'
78+
79+
DOCKER_IMAGE_TAG ?= latest
80+
81+
.PHONY: docker-image
82+
docker-image:
83+
docker build -t enapter:latest .

0 commit comments

Comments
 (0)