Initial commit

This commit is contained in:
Artem Mamonov
2025-02-06 02:36:10 +01:00
commit acf9b43671
24 changed files with 1946 additions and 0 deletions

36
Makefile Normal file
View File

@@ -0,0 +1,36 @@
APP_NAME = backend
CMD_DIR = cmd/$(APP_NAME)
DOCKER_IMAGE_NAME = photodisk:latest
DOCKER_REGISTRY = registry.rgkn.dev
# Default target: builds the application for the host OS
build:
@echo "Building the application for the host OS..."
go build -o $(CMD_DIR)/$(APP_NAME) $(CMD_DIR)/main.go
# Build the application for Linux
build-linux:
@echo "Building the application for Linux..."
CGO_ENABLED=1 go build -tags musl --ldflags "-extldflags -static" -o $(CMD_DIR)/$(APP_NAME) $(CMD_DIR)/main.go
# Run the application
run:
@echo "Running the application..."
go run $(CMD_DIR)/main.go $(ARGS)
# Build Docker image
docker:
@echo "Building Docker image..."
docker buildx build -t $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_NAME) --platform linux/amd64,linux/arm64 -f Dockerfile --push .
deploy: docker
@echo "Deploying Docker image..."
docker tag $(DOCKER_IMAGE_NAME) $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_NAME)
docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_NAME)
# Clean up
clean:
@echo "Cleaning up..."
rm -f $(CMD_DIR)/$(APP_NAME)
.PHONY: build build-linux run docker clean