-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* version for Code Engine * Db2 driver version * Db2 driver version * old CF branch
- Loading branch information
1 parent
f5640e2
commit 152243f
Showing
8 changed files
with
82 additions
and
22 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
######## | ||
# Python dependencies builder | ||
# | ||
# Full official Debian-based Python image | ||
FROM python:3.8 AS builder | ||
|
||
# Always set a working directory | ||
WORKDIR /app | ||
# Sets utf-8 encoding for Python et al | ||
ENV LANG=C.UTF-8 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
|
||
# Ensures that the python and pip executables used | ||
# in the image will be those from our virtualenv. | ||
ENV PATH="/venv/bin:$PATH" | ||
|
||
# Install OS package dependencies. | ||
# Do all of this in one RUN to limit final image size. | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Setup the virtualenv | ||
RUN python -m venv /venv | ||
|
||
# Install Python deps | ||
COPY requirements.txt ./ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
|
||
# Actual container | ||
# | ||
# | ||
FROM python:3.8-slim AS app | ||
|
||
# Extra python env | ||
ENV PATH="/venv/bin:$PATH" | ||
|
||
WORKDIR /app | ||
EXPOSE 8080 | ||
|
||
# copy in Python environment | ||
COPY --from=builder /venv /venv | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
libxml2 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# copy in the rest of the app | ||
COPY ./ ./ | ||
ENTRYPOINT ["gunicorn", "--bind", "0.0.0.0:8080","worldcities:app"] |
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 |
---|---|---|
@@ -1,10 +1,17 @@ | ||
**Note**: A former version of the tutorial deployed the app to Cloud Foundry Public on IBM Cloud. You can find the material in the [branch **cloudfoundry**](https://github.com/IBM-Cloud/cloud-sql-database/tree/cloudfoundry). | ||
|
||
# IBM Cloud SQL Database | ||
This tutorial shows how to provision a SQL (relational) database service, create a table and load a larger data set, city information into the database. Thereafter, we deploy a web app "worldcities" to make use of that data and show how to access the cloud database. The app is written in Python using the Flask framework. | ||
|
||
This tutorial is part of [IBM Cloud tutorials](https://cloud.ibm.com/docs/tutorials?topic=solution-tutorials-tutorials) and discussed as [SQL Database for Cloud Data](https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-sql-database). | ||
|
||
# Up and running in few steps | ||
To get this SQL database-backed app up and running only few steps and about 10 minutes are needed. Please follow the steps outlined in the IBM Cloud tutorial. | ||
|
||
|
||
# Local testing | ||
|
||
- Install the requirements to run Python directly or build and run the container image. | ||
- Set the environment variable **DASHDB_SSLDSN** to the value obtained from the Db2 Warehouse credentials for the key **ssldsn**. | ||
|
||
# Feedback | ||
If you have feedback on the code or the related tutorial, please either open an issue on this repository or leave documentation feedback at the above mentioned tutorial. | ||
If you have feedback on the code or the related tutorial, please open an issue on this repository. |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
Flask | ||
ibm_db | ||
Flask==2.0.3 | ||
gunicorn | ||
ibm_db == 3.1.2 | ||
python-dotenv==0.15.0 |
This file was deleted.
Oops, something went wrong.
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