-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import demo Dockerfiles and sample project
- Loading branch information
Showing
14 changed files
with
212 additions
and
2 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,14 @@ | ||
FROM centos:7 | ||
|
||
# Install python from EPEL repository | ||
RUN yum install -y epel-release && yum install -y python36 && alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 | ||
ENV AP_PYTHONHOME=/usr | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] |
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,14 @@ | ||
FROM debian:buster | ||
|
||
# Install python from main repository | ||
RUN apt-get update && apt-get install -y python3.6 libpython3.6 | ||
ENV AP_PYTHONHOME=/usr | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] |
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,21 @@ | ||
FROM debian:jessie as builder | ||
|
||
# download and build Python | ||
RUN apt-get update && apt-get install -y libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev wget | ||
RUN wget -O /root/Python-3.6.6.tar.xz https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz && (cd /root; tar xf Python-3.6.6.tar.xz) | ||
RUN (cd /root/Python-3.6.6; ./configure --enable-optimizations --enable-shared && make -j 8 build_all && make altinstall) | ||
|
||
FROM debian:jessie | ||
|
||
# Copy built python to fresh image | ||
COPY --from=builder /usr/local /usr/local | ||
ENV AP_PYTHONHOME=/usr/local | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] |
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,21 @@ | ||
FROM debian:stretch as builder | ||
|
||
# download and build Python | ||
RUN apt-get update && apt-get install -y libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev wget | ||
RUN wget -O /root/Python-3.6.6.tar.xz https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz && (cd /root; tar xf Python-3.6.6.tar.xz) | ||
RUN (cd /root/Python-3.6.6; ./configure --enable-optimizations --enable-shared && make -j 8 build_all && make altinstall) | ||
|
||
FROM debian:jessie | ||
|
||
# Copy built python to fresh image | ||
COPY --from=builder /usr/local /usr/local | ||
ENV AP_PYTHONHOME=/usr/local | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] |
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,14 @@ | ||
FROM opensuse/leap:15.0 | ||
|
||
# Add Python from default repository | ||
RUN zypper --non-interactive install python3 | ||
ENV AP_PYTHONHOME=/usr | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] |
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,22 @@ | ||
FROM opensuse/leap:42.3 as builder | ||
|
||
# download and build Python | ||
RUN zypper --non-interactive install readline-devel sqlite3-devel libbz2-devel zlib-devel libopenssl-devel wget tar gcc make | ||
RUN wget -O /root/Python-3.6.6.tar.xz https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz && (cd /root; tar xf Python-3.6.6.tar.xz) | ||
RUN (cd /root/Python-3.6.6; ./configure --enable-optimizations --enable-shared && make -j 8 build_all && make altinstall) | ||
|
||
FROM opensuse/leap:42.3 | ||
|
||
# Copy built python to fresh image | ||
COPY --from=builder /usr/local /usr/local | ||
ENV AP_PYTHONHOME=/usr/local | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] | ||
|
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,14 @@ | ||
FROM ubuntu:bionic | ||
|
||
# Install from main repository | ||
RUN apt-get update && apt-get install -y python3.6 libpython3.6 | ||
ENV AP_PYTHONHOME=/usr | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] |
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,16 @@ | ||
FROM ubuntu:xenial | ||
|
||
# Install from deadsnakes PPA | ||
RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt-get update && apt-get install -y python3.6 libpython3.6 | ||
ENV AP_PYTHONHOME=/usr | ||
|
||
# Add sample project to image | ||
COPY core /opt/apamacore | ||
COPY project /opt/project | ||
COPY launch.sh /opt/launch.sh | ||
|
||
# Launch image with correct settings to run project | ||
ENTRYPOINT ["/opt/launch.sh"] | ||
CMD ["correlator", "--config", "/opt/project"] | ||
|
||
|
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,46 @@ | ||
# linux-python-apama-docker | ||
Dockerfiles to demonstrate installing Python on different operating systems and using them with Apama | ||
# Apama core python installation in Docker | ||
|
||
This project contains Dockerfile for installing Python 3.6 on various Linux | ||
base images. It also contains a simple Apama project to demonstrate use of | ||
this Python with Apama. | ||
|
||
## License | ||
|
||
Copyright (c) 2018 Software AG, Darmstadt, Germany and/or its licensors | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this | ||
file except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
|
||
## Using the Dockerfiles | ||
|
||
To use these Dockerfiles you will need a copy of the Apama 10.3 core | ||
installation from [http://www.apamacommunity.com](http://www.apamacommunity.com/). Unpack it into this directory | ||
under a folder named 'core'. | ||
|
||
Next, choose one of the following Linux distributions to use as your base image: | ||
|
||
* CentOS 7 (Installs Python from EPEL repository) | ||
* Ubuntu Bionic (Installs Python from main repository) | ||
* Debian Buster (Installs Python from main repository) | ||
* OpenSuse Leap 15 (Installs Python from main repository) | ||
* Ubuntu Xenial (Installs Python from a PPA) | ||
* Debian Stretch (Builds Python from source) | ||
* Debian Jessie (Builds Python from source) | ||
* OpenSuse Leap 42 (Builds Python from source) | ||
|
||
Once you have chosen the distribution and release to use as a base image, build the image with: | ||
|
||
docker build -t projectimage -f Dockerfile.distribution:release . | ||
|
||
Once that has completed you can run the demo project in the docker image with: | ||
|
||
docker run --rm -t -i projectimage | ||
|
||
## Using Python within Apama | ||
|
||
For more details about how to use Python within Apama please see the documentation and forums on [http://www.apamacommunity.com](http://www.apamacommunity.com) |
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,4 @@ | ||
#!/bin/bash -- | ||
. /opt/apamacore/Apama/bin/apama_env | ||
|
||
"$@" |
Binary file not shown.
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,6 @@ | ||
monitor m { | ||
import "test" as test; | ||
action onload() { | ||
test.helloWorld(); | ||
} | ||
} |
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,11 @@ | ||
from apama.eplplugin import EPLPluginBase, EPLAction | ||
|
||
|
||
class test(EPLPluginBase): | ||
def __init__(self, init): | ||
super(test, self).__init__(init) | ||
|
||
@EPLAction('action<>') | ||
def helloWorld(self): | ||
self.getLogger().info("Hello World") | ||
|
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,9 @@ | ||
eplPlugins: | ||
test: | ||
pythonFile: ${PARENT_DIR}/test.py | ||
class: test | ||
|
||
correlator: | ||
initialization: | ||
list: | ||
- ${PARENT_DIR}/test.mon |