A generic makefile for projects.
Project description
sumake
Introduction
sumake is an extension of make that simplifies deployment tasks by providing integrated, convenient operations. It makes the deployment process effortless and efficient. With sumake, you can easily build, run, and manage your Docker containers both locally and remotely. The commands are straightforward and designed to save you time and effort.
Feature
- Remote Docker Operations: Build images and run containers on remote servers seamlessly using "remote access for Docker" (
docker-build-remote,docker-run-remote).- Automatic Restart Container: Automatically build on the server, automatically restart containers. Simple, hassle-free, effortless!
- Simplified Workflow: Provides intuitive
maketargets abstracting complex Docker commands. - Environment Variable Integration: Easily configure builds and runs using environment variables and
.env.makefiles. - Multi-Server Deployment: Supports one-click deployment to multiple servers, simplifying the process of managing and scaling your applications across different environments.
Install
-
install pip
-
pip install sumake -U
docker-run-remote
Example
.env.make
DOCKER_REPOSITORY=sucicada
DOCKER_SERVICE_NAME=japanese-red-blue-book
#DOCKER_SERVICE_PORT=9096
DOCKER_HOST=server.sucicada.me
DOCKER_RUN_OPTS="-p 9086:80"
run at the root of the project:
sumake docker-run-remote
it same as :
DOCKER_HOST=server.sucicada.me \
docker build -t \
sucicada/japanese-red-blue-book:latest .
DOCKER_HOST=server.sucicada.me \
docker stop japanese-red-blue-book
DOCKER_HOST=server.sucicada.me \
docker rm japanese-red-blue-book
DOCKER_HOST=server.sucicada.me \
docker run -d --name japanese-red-blue-book \
-p 9086:80 \
sucicada/japanese-red-blue-book:latest
Prerequisites
- Remote Access for Docker: Ensure that the Docker daemon on the remote server is configured to accept remote connections. https://docs.docker.com/engine/daemon/remote-access/
Once configured, you can check the access to the remote server by running:sumake docker-info-remoteIf you see the correct remote docker info, it means the remote access for Docker is working.
How to use
-
go to the root of the project.
-
Set the environment variables in the
.env.makefile. Configuration reference -
Run the command:
sumake docker-run-remote -
You can see the remote docker build logs
Environment Variables:
- DOCKER_SERVICE_NAME: (required) The name of the docker container.
- DOCKER_SERVICE_PORT: (optional) The port of the docker container. You can set it when you want to expose the port of the docker container. (Equal to docker command:
"-p <port>:<port>") - DOCKER_HOST: (required) The host of the docker server. Remember to set remote access for Docker on the server. remote access for Docker
- DOCKER_REPOSITORY: (optional) The Docker repository name. Defaults to your Docker Hub username if not set. Used to tag the image (e.g.,
<DOCKER_REPOSITORY>/<DOCKER_SERVICE_NAME>:latest). - DOCKER_RUN_OPTS: (optional) Additional options for the
docker runcommand (e.g.,"-p 8080:80 -v /data:/app/data"). This allows for flexible configuration like port mapping, volume mounting, etc.
Install GNU Make
macOS:
brew install make
Ubuntu / Debian / Linux Mint:
sudo apt-get install make
Red Hat / Fedora / CentOS:
sudo yum install make
Arch Linux:
sudo pacman -S make
dev
(For project development)
make install
pip install .
Note: make install assumes a local development setup and might require a Makefile in the project root.
zsh
~/.zshrc
autoload -U compinit
compinit
_sumake() {
_make "$@"
}
compdef _sumake sumake
zstyle ':completion::complete:sumake:*:targets' call-command true
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sumake-0.3.0.tar.gz.
File metadata
- Download URL: sumake-0.3.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bbce2f77c99ef195404b237e9fc88d687f71664b3343009082bba87b6d9e640
|
|
| MD5 |
426f46324cd5d087acddb5d292de1a7f
|
|
| BLAKE2b-256 |
bceefa2f848f7cdf506006d8ee37af014b8e68218cd247ee0aa63bde7c81be7d
|