Skip to content
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
16 changes: 16 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim

# Set the working directory in the container
WORKDIR /pdl

# Copy the current directory contents into the container at /app
COPY . /pdl

# Install any needed dependencies specified in requirements.txt
RUN pip install .
RUN pip install '.[all]'


# Run app.py when the container launches
ENTRYPOINT ["pdl-local"]
36 changes: 36 additions & 0 deletions pdl/pdl_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import subprocess
import sys

WATSONX_APIKEY = "WATSONX_APIKEY=" + os.environ["WATSONX_APIKEY"]
WATSONX_URL = "WATSONX_URL=" + os.environ["WATSONX_URL"]
WATSONX_PROJECT_ID = "WATSONX_PROJECT_ID=" + os.environ["WATSONX_PROJECT_ID"]
LOCAL_DIR = os.getcwd() + ":/local"


def main():
subprocess.run(
[
"docker",
"run",
"-v",
LOCAL_DIR,
"-w",
"/local",
"-e",
WATSONX_APIKEY,
"-e",
WATSONX_URL,
"-e",
WATSONX_PROJECT_ID,
"--rm",
"-it",
"pdl-runner",
*sys.argv[1:],
],
check=True,
)


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ Repository = "https://github.com/IBM/prompt-declaration-language"
Issues = "https://github.com/IBM/prompt-declaration-language/issues"

[project.scripts]
pdl = "pdl.pdl:main"
pdl-local = "pdl.pdl:main"
pdl = "pdl.pdl_runner:main"