Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker #39

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# start by pulling the python image
FROM python:3.11.9-slim-bullseye

# copy the requirements file into the image
COPY ./requirements.txt /app/requirements.txt

# switch working directory
WORKDIR /app

# install the dependencies and packages in the requirements file
RUN pip install -r requirements.txt

# copy every content from the local file to the image
COPY . /app

# configure the container to run in an executed manner
ENTRYPOINT [ "python" ]

CMD ["run.py", "--docker"]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ For a list of code examples that use the Web Forms API, see the [How-to guides o
**Note:** You will need to alias the python command to run Python 3 or use `python3 run.py`
1. Open a browser to http://localhost:3000

### Installation steps with docker
1. `docker image build -t docusign .`
1. `docker run --name docusign_python -p 3000:3000 -d docusign`

### Installation steps for JWT Grant authentication

**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the Docusign Developer Center, skip step 4 as it was automatically performed for you.
Expand Down
9 changes: 6 additions & 3 deletions run.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
from app import app
from flask_session import Session
import os
import sys

host = "0.0.0.0" if "--docker" in sys.argv else "localhost"
port = int(os.environ.get("PORT", 3000))

if os.environ.get("DEBUG", False) == "True":
app.config["DEBUG"] = True
app.config['SESSION_TYPE'] = 'filesystem'
sess = Session()
sess.init_app(app)
port = int(os.environ.get("PORT", 3000))
app.run(host="localhost", port=3000, debug=True)
app.run(host=host, port=port, debug=True)
else:
app.config['SESSION_TYPE'] = 'filesystem'
sess = Session()
sess.init_app(app)
app.run(host="localhost", port=3000, extra_files="api_type.py")
app.run(host=host, port=port, extra_files="api_type.py")

Loading