Skip to main content

No project description provided

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

artefacts_c2d-1.8.6.dev0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file artefacts_c2d-1.8.6.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for artefacts_c2d-1.8.6.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2256d3d8369068fcc90844e9954f05b391bb1078de28e7e0e2854dc4a8d42a6
MD5 76504f3b6d38d205a4e69818c086e0b2
BLAKE2b-256 5e47d740f3b02672e688da850d91c08b30221c461288dc4495632f1e9fe5277b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page