Skip to main content

Code to Docker

Processor to convert source code into a Artefacts-ready Dockerfile, following guidance from a configuration file.

Setup and development

  • Python 3.11

Setting Up a Dev Environment

It is best practice to setup a virtual environment. One way to do this is by using virtualenv which can be installed with pip install virtualenv.

Once done, setup your environment for this repo by running the following commands

python3.11 -m venv env
source env/bin/activate
pip install -r requirements.txt
# and for dev environments
pip install -r requirements-dev.txt

You will note that running pip list will only have the packages required for this repo (and not everything you might have installed on your computer).

(The env folder created is already noted in .gitignore file so wont be pushed up to github)

Publication

The package is published on a private repository hosted on AWS. Publication is automated:

./scripts/publish [AWS profile name]

If your account is default, no parameter needed. The script relies on Twine (in the development requirements) to package and deploy to AWS CodeArtifact.

Usage

Generating the DockerFile

The repository contains fake but valid configuration files in examples/. A simple trial is to execute:

PYTHONPATH=src python src/c2d/cli.py . -c examples/basic/config.yaml -o examples/basic/

(or whichever file you wish)

The command results in a Dockerfile generated under examples/basic, ready to build with Docker.

You can also pass the additional flag --as_text to simply output the dockerfile as a string rather than creating an actual file.

Building the Dockerfile

docker build -t <tagName> .

Running the Dockerfile (using Artefacts)

  • Create your project on artefacts.com, generate an api key and keep a note of it.
  • The project name should match the project in the warp.yaml file.
  • Place the dockerfile and artefacts.yaml in the root of your project, then run
docker run --env ARTEFACTS_KEY=<generatedApiKey>  --env ARTEFACTS_JOB_NAME=<jobNameSetInConfigFile> <tagName>

(For the dev environment you will want to add this additional env --env ARTEFACTS_API_URL=https://ui.artefacts.com/api)

The auto-generated dockerfiles by c2d are designed to run headless, even if the project requires a display. Examples can be seen when running turtlesim examples. If you do however want to use a display for your tests, you can add the following flags to your docker run command --network=host --env DISPLAY=$DISPLAY

Metadata

Release files for artefacts-c2d 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for artefacts-c2d 1.9.0
File Interpreter ABI Platform
artefacts_c2d-1.9.0-py3-none-any.whl Python 3 none any Details

Release files / artefacts_c2d-1.9.0-py3-none-any.whl

Download URL artefacts_c2d-1.9.0-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02fa802fe716fdccb8ed11202e1a6aed959c7b321b50faf30a0273cc1dc29b34
BLAKE2b-256 checksum
How to use checksums
a7cfeacee89ad72a186134936502a13f2678a741d85188d831d415eb07218667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.9.0 This release

1 release file

1.8.12

1 release file

1.8.11

1 release file

1.8.10

1 release file

1.8.9

1 release file

1.8.8

1 release file

1.8.7

1 release file

1.8.6

1 release file

1.8.5

1 release file

1.8.4

1 release file

1.8.3

1 release file

1.8.2

1 release file

1.8.1

1 release file

1.8.0

1 release file

1.7.2

1 release file

1.7.1

1 release file

1.7.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page