Skip to content

Build Project Image

Containers are a best practice for deployment, and offer several advantages for development. This outlines a typical scenario for building images for API Logic Server projects.

💡 TL;DR - edit/use the pre-built dockerfile to build and push your project

devops/docker-image/build-image.dockerfile is pre-built into your project. Alter it for your organization and project name. It contains instructions for using it via the command line to build and push your image.

Container Overview

The diagram above identifies 3 important images you can build, described below.


MyApp: containerize project

This is the image you will deploy for production. It includes Python, API Logic Server, any additional packages your require, and your app (Python and logic). These are defined by a dockerfile.

API Logic Projects1 include a devops/docker-image/build-image.dockerfile for containerizing your application, shown at right in the diagram below. Click here to see the key files.

A key aspect of images is that you can extend an existing image: add new software to build another image. See the line:

FROM --platform=linux/amd64 apilogicserver/api_logic_server

This builds your projects' image, starting with API Logic Server image, for amd (Intel) platforms.

Docker Repositories

To build an image for your ApiLogicProject:

  1. On Docker Hub, create a docker repository under your docker account.
  2. Create / customize your project as your normally would
  3. Edit change your_account/your_repository as appropriate
  4. In terminal (not in VSCode docker - docker CLI is not installed there),
    cd < your-project>
  5. Run
    sh devops/docker-image/ . # builds the image locally

  6. Deploy to Docker Hub

docker tag your_account/your_repository your_account/your_repository:1.00.00
docker login
docker push your_account/your_repository:1.00.00

To run your project container, see the next page.


MyPkgs: Containerize Packages

Your project may require additional packages not already included with API Logic Server. You have 2 choices how to include these:

  • Standard pip - per Python standards, your project includes a requirements.txt file; update it with your dependencies.

  • If your team is using Dev Containers for development, it is a best practice to establish dependencies in a new image MyPkgs, then build your MyApp container from that.


MyDB: Test Databases

One of the great things about Docker is the ability to install popular databases, with no hassle. Follow the procedures described in Connection Examples.\

You can use this to optionally manage your test databases with containers that can run both locally, or on a cloud / server.

  1. Several changes were made as of release 9.01.17.