Skip to content

Commit 2783ed8

Browse files
authored
create and store images for example servers (#15)
* add py docker image * build image * fix image version * push docker image * fix image name * change image name * remove version * split to jobs * install py * fix * remove img * add pkg * fix cp * fix2 * print * print2 * prints * change to copy * remove prints * fix comments * run only in main run only in main
1 parent 80ad194 commit 2783ed8

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Python package
22

33
on: [push]
44

5+
env:
6+
EXAMPLE_IMAGE_NAME: ghcr.io/descope/py-example:0.1
7+
58
jobs:
69
build:
710

@@ -52,6 +55,21 @@ jobs:
5255
run: |
5356
python -m pytest tests/*
5457
58+
pkg:
59+
runs-on: ubuntu-latest
60+
needs: build
61+
if: ${{ github.ref == 'refs/heads/main' }}
62+
steps:
63+
- uses: actions/checkout@v3
64+
- name: Set up Python
65+
uses: actions/setup-python@v4
66+
with:
67+
python-version: 3.7
68+
69+
- name: Install dependencies
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install -r requirements-dev.txt
5573
- name: Build package
5674
run: |
5775
mkdir src
@@ -61,4 +79,20 @@ jobs:
6179
uses: actions/upload-artifact@v3
6280
with:
6381
name: descope-auth-0.0.1.tar.gz
64-
path: ./dist/descope-auth-0.0.1.tar.gz
82+
path: ./dist/descope-auth-0.0.1.tar.gz
83+
84+
- run: cp ./dist/descope-auth-0.0.1.tar.gz samples/
85+
86+
- name: Build example docker image
87+
working-directory: samples/
88+
run: |
89+
docker build . --tag ${{ env.EXAMPLE_IMAGE_NAME }}
90+
91+
- name: Log in to the Container registry
92+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
93+
with:
94+
registry: ghcr.io
95+
username: ${{ github.actor }}
96+
password: ${{ secrets.GITHUB_TOKEN }}
97+
- name: Push the tagged Docker image
98+
run: docker push ${{ env.EXAMPLE_IMAGE_NAME }}

samples/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3
2+
3+
WORKDIR /home/app
4+
5+
COPY descope-auth-0.0.1.tar.gz /home/app
6+
7+
RUN pip3 install /home/app/descope-auth-0.0.1.tar.gz
8+
9+
ADD requirements.txt /home/app
10+
RUN pip3 install -r requirements.txt
11+
12+
ADD . /home/app
13+
CMD python3 otp_web_sample_app.py
14+
15+
EXPOSE 3000

samples/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
requests
2+
flask
3+
flake8
4+
PyJWT
5+
Descope-Auth

0 commit comments

Comments
 (0)