@@ -35,6 +35,88 @@ A docker image and python package are provided for use as a base image in `docke
`common_package/sql/` contains the .sql files `create_tables.sql` and `fill_tables.sql` which serve as examples for how to initialize a postgres Database in your project (See below in the Creating an extensible Database Python Class section for details in how to create the Python Class.) The `volumes` statement in the docker-compose files runs these sql files once the container is created.
## Docker Installation stuff
# docker-prototype
This repository contains a prototype for a Docker-based development environment
for Python scripts that uses the `pygarden[postgres]` package to allow for easy
interaction with a PostgreSQL database. Additionally, the `requests` package is
used to make HTTP requests to a APIs.
## Getting Started
This project makes extensive use of Docker and Docker Compose to create a
development environment for Python scripts. To get started, follow the steps
below:
1. Create a `.env` file in the root of the project and add the following
environment variables:
```bash
PYTHON_VERSION=3.11 # choose which version of Python you want to build
PYGARDEN_INSTALL_TOKEN=<your-pygarden-token> # get a token that will allow you to install pygarden
# optional DB environment variables
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
```
2. (If using Docker's bake) Create a multiarch-builder and use it
```bash
docker run --privileged--rm tonistiigi/binfmt --install all
docker buildx create \
--name multiarch-builder \
--driver docker-container \
--platform linux/amd64,linux/arm64 \
--use
docker buildx inspect --bootstrap
```
3. Build the Docker image and start the container:
Using Docker Compose:
```bash
source .env # source the .env file you created above
docker compose build # build the Docker image
docker compose run pygarden python # start the container and run the Python REPL
```
or if you are using Docker's bake:
```bash
docker buildx bake --push# build and push all the targets
If you want to save the image to a tar file, you can run:
```bash
docker save savannah.ornl.gov/common/pygarden:${PYTHON_VERSION:-3.12}-latest-o pygarden.tar
gzip pygarden.tar # optionally compress the tar file
```
Now you can transport the image wherever you'd like!
## Releases
To initiate a release, increment the value in `COMMON_VERSION` run `./release.sh release`. This will force checkout develop and run the release process to push to the package registry and container registry.