Fixed docker issues
Some checks failed
Docker Deploy / build-and-push (push) Failing after 46s

This commit is contained in:
Atridad Lahiji 2025-02-01 17:12:52 -06:00
parent 29ce5a67df
commit 97b805b422
Signed by: atridad
SSH key fingerprint: SHA256:LGomp8Opq0jz+7kbwNcdfTcuaLRb5Nh0k5AchDDb438
4 changed files with 16 additions and 23 deletions

View file

@ -7,19 +7,16 @@ COPY go.mod go.sum ./
RUN go mod download && \
go install github.com/swaggo/swag/cmd/swag@latest
# Copy source code and Makefile
# Copy source code
COPY . .
# Install required tools and make scripts executable
RUN apk add --no-cache upx make bash && \
chmod +x /app/lib/stylegen/gen.sh
# Create necessary directories
RUN mkdir -p /app/public/css
# Install tools
RUN apk add --no-cache upx make
# Generate assets and build with optimizations
SHELL ["/bin/bash", "-c"]
RUN cd /app && make generate && \
RUN set -eux; \
cd /app; \
make generate; \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags='-s -w -extldflags "-static"' \
-tags netgo,osusergo \
@ -29,7 +26,6 @@ RUN cd /app && make generate && \
FROM scratch
# Copy static files and assets
COPY --from=builder /app/public/css/styles.css /public/css/styles.css
COPY --from=builder /app/docs /docs
COPY --from=builder /go/bin/app /app

View file

@ -44,27 +44,28 @@ ensure-swag:
go install github.com/swaggo/swag/cmd/swag@latest; \
}
reset:
reset: docker-clean
@echo "$(CLEAN) Performing complete project reset..."
@rm -f $(BINARY_NAME)
@rm -rf public/css/styles.css
@rm -rf docs/docs.go docs/swagger.json docs/swagger.yaml
@go clean -cache -testcache -modcache
@rm -rf $(BASE_PATH)/tw # Remove the 'tw' directory
@echo "$(CHECK) Project reset complete"
clean:
@echo "$(CLEAN) Cleaning build artifacts..."
@rm -f $(BINARY_NAME)
@rm -f public/css/styles.css
@echo "$(CHECK) Cleanup complete"
docker-clean:
@echo "$(CLEAN) Cleaning Docker artifacts..."
@docker-compose down --rmi all --volumes
@echo "$(CHECK) Docker cleanup complete"
swaggergen: ensure-swag
@echo "$(DOCS) Generating Swagger documentation..."
@swag init
@echo "$(CHECK) Swagger docs generated"
# Combined generation target
generate: swaggergen
build: generate

View file

@ -15,11 +15,4 @@ I change what I use _constantly_ in order to find something that feels just righ
7. Dataflare - A simple but powerful cross-platform database client. Supports most common databases, including LibSQL which is rare!
8. Bruno - A simple and powerful API client, similar to Postman. An critical tool to debug API endpoints.
I hope you found this helpful! This will be periodically updated to avoid outdated recommendations.
```javascript
let x = 2;
console.log(x);
```
## H2
### H3
I hope you found this helpful! This will be periodically updated to avoid outdated recommendations.

View file

@ -20,6 +20,9 @@ import (
//go:embed public/*
var PublicFS embed.FS
//go:embed docs/*
var DocsFS embed.FS
// @title Atri.dad API
// @version 1.0
// @description This is the API for atri.dad