File: Dockerfile

package info (click to toggle)
python-oracledb 1.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,224 kB
  • sloc: python: 17,637; sql: 1,819; makefile: 41
file content (84 lines) | stat: -rw-r--r-- 2,539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# NAME
#
#   Dockerfile
#
# PURPOSE
#
#   Creates a container with the Python python-oracledb samples and a running
#   Oracle Database so python-oracledb can be evaluated.
#
#   Python-oracledb is the Python database driver for Oracle Database.  See
#   https://oracle.github.io/python-oracledb/
#
# USAGE
#
#   Get an Oracle Database container (see
#   https://hub.docker.com/r/gvenzl/oracle-xe):
#
#     podman pull docker.io/gvenzl/oracle-xe:21-slim
#
#   Create a container with the database, Python, python-oracledb and the
#   samples. Choose a password for the sample schemas and pass it as an
#   argument:
#
#     podman build -t pyo --build-arg PYO_PASSWORD=a_secret .
#
#   Start the container, which creates the database. Choose a password for the
#   privileged database users and pass it as a variable:
#
#     podman run -d --name pyo -p 1521:1521 -it -e ORACLE_PASSWORD=a_secret pyo
#
#   Log into the container:
#
#     podman exec -it pyo bash
#
#   At the first login, create the sample schema:
#
#     python setup.py
#
#   Run samples like:
#
#     python bind_insert.py
#
#   The database will persist across container shutdowns, but will be deleted
#   when the container is deleted.

FROM docker.io/gvenzl/oracle-xe:21-slim

USER root

RUN microdnf module disable python36 && \
    microdnf module enable python39 && \
    microdnf install python39 python39-pip python39-setuptools python39-wheel vim vi httpd-tools && \
    microdnf clean all

WORKDIR /samples/

COPY setup.py setup.py

RUN  curl -LO https://github.com/oracle/python-oracledb/archive/refs/heads/main.zip && \
     unzip main.zip && mv python-oracledb-main/samples/* . && \
     /bin/rm -rf python-oracledb-main samples main.zip && \
     cat create_schema.py >> /samples/setup.py && chown -R oracle.oinstall /samples/

USER oracle

RUN  python3 -m pip install oracledb Flask --user --no-warn-script-location

ARG PYO_PASSWORD

ENV PYO_SAMPLES_MAIN_USER=pythondemo
ENV PYO_SAMPLES_MAIN_PASSWORD=${PYO_PASSWORD}
ENV PYO_SAMPLES_EDITION_USER=pythoneditions
ENV PYO_SAMPLES_EDITION_PASSWORD=${PYO_PASSWORD}
ENV PYO_SAMPLES_EDITION_NAME=python_e1
ENV PYO_SAMPLES_CONNECT_STRING="localhost/xepdb1"
ENV PYO_SAMPLES_DRCP_CONNECT_STRING="localhost/xepdb1:pooled"
ENV PYO_SAMPLES_ADMIN_USER=system

# Run the samples using the default python-oracledb 'Thin' mode, if possible
ENV PYO_SAMPLES_DRIVER_MODE="thin"

# The privileged user password is set in setup.py from the "podman run"
# environment variable ORACLE_PASSWORD
#ENV PYO_SAMPLES_ADMIN_PASSWORD=