Skip to content

Commit

Permalink
Feat/add makefile (#21)
Browse files Browse the repository at this point in the history
* develop

* release/0.0.6

* feat: add Dockerized build and run support

- Added Makefile for Dockerized application
- Defined Docker image and version variables
- Included Docker commands for build, run, exec, stop, clean, and rebuild

Why: Facilitate easy development, testing, and deployment using Docker.
  • Loading branch information
andersonbosa authored Nov 11, 2023
1 parent c9c2ced commit 36548c2
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Makefile for building and running a Dockerized application

# Docker image name and version
IMAGE_NAME := zarn
IMAGE_VERSION := unstable
CONTAINER_NAME := $(IMAGE_NAME)-container

# Docker commands
DOCKER := docker
DOCKER_BUILD := $(DOCKER) build
DOCKER_RUN := $(DOCKER) run
DOCKER_EXEC := $(DOCKER) exec
DOCKER_RM := $(DOCKER) rm
DOCKER_RMI := $(DOCKER) rmi


# Build the Docker image
build:
$(DOCKER_BUILD) -t $(IMAGE_NAME):$(IMAGE_VERSION) .

# Run the Docker container
run:
$(DOCKER_RUN) --rm --name $(CONTAINER_NAME) $(IMAGE_NAME):$(IMAGE_VERSION)

# Execute a command inside the running container
exec:
$(DOCKER_EXEC) -it $(CONTAINER_NAME) sh

# Stop and remove the Docker container
stop:
$(DOCKER) stop $(CONTAINER_NAME)
$(DOCKER_RM) $(CONTAINER_NAME)

# Remove the Docker image
clean:
$(DOCKER_RMI) $(IMAGE_NAME):$(IMAGE_VERSION)

# Rebuild the Docker image and run the container
rebuild: clean build run

# Default target
.DEFAULT_GOAL := build

0 comments on commit 36548c2

Please sign in to comment.