Installing
Install locally
Prerequisites
activated Python virtual environment such as miniconda or virtualenv, Python Version 3.9 or higher.
Install encab
pip install encab
Test installation
Create sample encab file encab.yml
encab:
dry_run: false
programs:
main:
sh:
- echo "Hello Encab!"
Run locally:
encab
The result will be something like this:
INFO encab: encab 1.0.5
INFO encab: Using configuration file ./encab.yml, source: Default location.
INFO main: Hello Encab!
INFO main: Exited with rc: 0
Install in Container
Prerequisites
Docker from your Linux distribution or Docker Desktop.
Create sample encab file encab.yml
encab:
dry_run: false
programs:
main:
sh:
- echo "Hello Encab!"
Add Encab to your Dockerfile.
FROM python:3.10.8-slim-bullseye
# --------------------------------------------
# Install Venv
#
ENV VIRTUAL_ENV=/opt/encabenv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN python3 -m venv $VIRTUAL_ENV && \
pip install --upgrade pip
# --------------------------------------------
# Install Encab
#
RUN pip install encab
# -------------------------------------------
# add configuration file
#
ADD encab.yml .
# -------------------------------------------
# set encab as entrypoint
ENTRYPOINT ["encab"]
Build container
docker build -t encab_minimum .
Test installation
Run container
docker run encab_minimum
Result:
INFO encab: encab 1.0.5
INFO encab: Using configuration file ./encab.yml, source: Default location.
INFO main: Hello world!
INFO main: Exited with rc: 0
From Source
Prerequisites
Docker from your Linux distribution or Docker Desktop.
git distributed version control system
Python Version >= 3.7
activated Python virtual environment such as miniconda or virtualenv
Download
git clone https://github.com/sebastian-kuebeck/encab.git
cd encab
pip install -r requirements.txt
Build Wheel
make dist
If all goes well, the encab wheel
file
will be in the dist directory.
It’s named encab-<version>-py3-none-any.whl
Testing (optional)
Run unit tests:
make test
Running
Run localy:
python -m encab
It’ll use the sample encab.yml file. The result will be something
like this:
INFO encab: encab 1.0.5
INFO encab: Using configuration file ./encab.yml, source: Default location.
INFO encab: Dry run. No program will be started.
INFO encab: settings are valid.
INFO encab: settings are valid.
INFO encab: settings are valid.
INFO encab: Dry run succeeded. Exiting.
Deployment
Copy the generated wheel file into your Docker project directory.
Create a configuration file
encab.yml(see Configuration section for details).programs: main: sh: echo 'Hello World'
Add Encab to your Docker file.
FROM python:3.10.8-slim-bullseye # -------------------------------------------- # Install Encab # ARG ENCAB_WHEEL=encab-1.0.5-py3-none-any.whl ENV PATH=$PATH:/root/.local/bin RUN python3 -m pip install --user pipx ADD ${ENCAB_WHEEL} . RUN python3 -m pipx install ./${ENCAB_WHEEL} # ------------------------------------------- # add configuration file # ADD encab.yml . # ------------------------------------------- # set encab as entrypoint ENTRYPOINT ["encab"]
Build container
docker build --build-arg ENCAB_WHEEL=`ls encab-*.whl` -t encab_minimum .
Run container
docker run encab_minimum
Result:
INFO encab: encab 1.0.5 INFO encab: Using configuration file ./encab.yml, source: Default location. INFO main: Hello world! INFO main: Exited with rc: 0