Skip to content

Commit

Permalink
feat: Added docker compose to use platform (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
13archit authored Oct 15, 2024
1 parent 79f185f commit cdecca8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,31 @@ PWD := $(shell pwd)

## Docker compose down
down:
@docker-compose down
@ARCH=$$(uname -m); \
if [ "$$ARCH" = "x86_64" ]; then \
PLATFORM="linux/amd64"; \
elif [ "$$ARCH" = "arm64" ] || [ "$$ARCH" = "aarch64" ]; then \
PLATFORM="linux/arm64"; \
else \
echo "${RED}Unsupported architecture: $$ARCH${RESET}"; \
exit 1; \
fi; \
PLATFORM=$$PLATFORM \
docker-compose down

## Docker compose up
up:
@docker-compose up -d
@ARCH=$$(uname -m); \
if [ "$$ARCH" = "x86_64" ]; then \
PLATFORM="linux/amd64"; \
elif [ "$$ARCH" = "arm64" ] || [ "$$ARCH" = "aarch64" ]; then \
PLATFORM="linux/arm64"; \
else \
echo "${RED}Unsupported architecture: $$ARCH${RESET}"; \
exit 1; \
fi; \
PLATFORM=$$PLATFORM \
docker-compose up -d

## Docker ssh kill
ssh:
Expand All @@ -86,4 +106,4 @@ help:
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
{ lastLine = $$0 }' $(MAKEFILE_LIST)
8 changes: 2 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
services:
devops:
container_name: devops
image: clouddrove/devops-machine:v0.0.1
image: ghcr.io/clouddrove/devops-machine
platform: ${PLATFORM}
mem_limit: 3g
memswap_limit: 3g
cpu_shares: 30
Expand All @@ -25,11 +26,6 @@ services:
networks:
dev_net_devops:
ipv4_address: 10.13.0.13
command: >
sh -c "chown -R ubuntu:ubuntu /home/ubuntu/ &&
service ssh start &&
su ubuntu -c 'tail -f /dev/null'"
networks:
dev_net_devops:
driver: bridge
Expand Down

0 comments on commit cdecca8

Please sign in to comment.