Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added docker compose to use platform #16

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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