Giter VIP home page Giter VIP logo

docker-compose-python's Introduction

Docker environment for python scripts

This is a base template for python in docker. The purpose of this repository is to make it easy to create, build and deploy python scripts with docker.

The container set is based on the official python:3-onbuild image.

Configuration

Put all your python module dependencies in the requirements.txt file. The dependencies will then be installed at build. All files in the same folder as the Dockerfile will be copied into /usr/src/app by the python base image.

Modify the docker-compose.yml and Dockerfile to your likings to configure exposed ports, volume mounts, extra files, scripts etc.

Using the image in development

To not have to rebuild the container each time you have updated your code. If you are using docker-compose, you can run the command:

docker-compose build && docker-compose run --rm app bash

This will build a docker image and with the dependencies in the requirements.txt file, and then run the container with the console attached.

If you are using the image with pure docker, you can use the following commands:

docker build -t my-python-app .
docker run -it --rm -v "$PWD:/usr/src/app my-python-app bash"

Note that you can also install the dependencies in requirements.txt after you entered the container.

Using the image in production or on a remote docker host

When the code is ready for production or you want to run it on a remote server, remove the volume mounts and add a storage volume/container to store your files. then run the code as a regular docker-compose container set.

docker-compose build
docker-compose up -d

docker-compose-python's People

Contributors

drerik 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.