Local Containerized Environment supports various programming languages
LocalEnv is a tool designed for local development, allowing you to execute code in multiple languages without installing numerous tools on your PC. With Docker as the only prerequisite, you can seamlessly run code in various environments.
Before you begin, ensure that you have Docker installed. It's also helpful to have a basic understanding of Docker concepts.
-
Quickly write and run code: LocalEnv allows you to rapidly write and execute code in containerized environments locally.
-
localenv script: The repository includes a convenient
localenv
script that simplifies the execution of code in different languages within Docker containerized environments. -
env folder: Contains the code and document for each supported language.
-
config.yaml file: This config file allows users to configure their target environment settings easily. This includes specifying Docker images, default container names, and base commands for each language.
# Clone LocalEnv repository
git clone https://github.com/tungbq/LocalEnv.git
cd LocalEnv
# Execute python code
./localenv python env/python/demo.py
# Execute javascript code
./localenv javascript env/javascript/demo.js
Current support languages in below table
Language | Quick Start | User guide | Image |
---|---|---|---|
Python | ./localenv python env/python/demo.py |
python | Find |
Powershell | ./localenv powershell env/powershell/demo.ps1 |
powershell | Find |
Groovy | ./localenv groovy env/groovy/demo.groovy |
groovy | Find |
Javascript | ./localenv javascript env/javascript/demo.js |
javascript | Find |
Golang | ./localenv golang env/golang/demo.go |
go | Find |
Java | ./localenv java env/java/demo.java |
java | Find |
To use the LocalEnv tool, follow these steps:
Clone the repository:
git clone https://github.com/tungbq/LocalEnv.git
cd LocalEnv
Configure your environment:
- Edit the config.yaml file to specify the details of the environment you want to use, for example:
# File: ./config.yaml
python:
image: 'python:3.12'
default_container_name: 'pyEnv'
base_command: 'python'
Write your own code under env, for example:
- Python: python
- Powershell: powershell
Run a script:
- Use the following command format to run your script within the containerized environment:
./localenv <language> <script_path>
For example, to run a Python script:
./localenv python env/python/demo.py
Refer to the user guide for detailed instructions on using each supported environment. Links to the user guides are available in the table above.
- For common issue, visit troubeshooting.md
- See: CONTRIBUTING.md
- If you find this repository helpful, kindly consider showing your appreciation by giving it a star β Thanks! π
- Feel free to open a new issue if you encounter the LocalEnv bug or want to request more content about LocalEnv
- Submit a new issue (π) if you encounter the bug/error when using this repo