Giter Club home page Giter Club logo

parameterized-entrypoint's Introduction

Docker parameterized entrypoint

A Docker entrypoint script that renders templates and runs scripts before starting the main application.

Usage

An example Dockerfile:

FROM nginx

COPY nginx.conf /templates/etc/nginx/nginx.conf

ADD https://github.com/jcassee/parameterized-entrypoint/releases/download/0.9.0/entrypoint_linux_amd64 /usr/local/bin/entrypoint
RUN chmod +x /usr/local/bin/entrypoint

ENTRYPOINT ["entrypoint", "--"]

RUN ["nginx", "-g", "daemon off;"]

When you run the container, all environment variables will be available in the nginx.conf template:

docker run -e domain=www.example.com example/nginx

If using environment variables is inconvenient, for example because the values are structured, you can set them in /variables.yml:

echo 'domain: www.example.com' > variables.yml
docker run -v $PWD/variables.yml:/variables.yml example/nginx

Paths can be customized using entrypoint command line options. See entrypoint -h for more details.

If you are debugging a container it is sometimes useful to disable the entrypoint functionality. Set the SKIP_ENTRYPOINT environment variable to a non-empty value to only run the command.

Building

pip install -r requirements.txt
python setup.py build

The application is available at dist/entrypoint.

It is also possible to build the Alpine Linux binary using Docker:

python setup.py build_alpine

The Alpine binary will be saved to dist/entrypoint-alpine. In order to use it, though, you need to add the following directive to your Dockerfile:

RUN ln -sfn /lib /lib64 && \
    ln -sfn /lib/ld-musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2

(See this discussion on GitHub.)

parameterized-entrypoint's People

Contributors

jcassee avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.