This commit is contained in:
parent
29ce5a67df
commit
97b805b422
4 changed files with 16 additions and 23 deletions
16
Dockerfile
16
Dockerfile
|
@ -7,19 +7,16 @@ COPY go.mod go.sum ./
|
||||||
RUN go mod download && \
|
RUN go mod download && \
|
||||||
go install github.com/swaggo/swag/cmd/swag@latest
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
|
||||||
# Copy source code and Makefile
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Install required tools and make scripts executable
|
# Install tools
|
||||||
RUN apk add --no-cache upx make bash && \
|
RUN apk add --no-cache upx make
|
||||||
chmod +x /app/lib/stylegen/gen.sh
|
|
||||||
|
|
||||||
# Create necessary directories
|
|
||||||
RUN mkdir -p /app/public/css
|
|
||||||
|
|
||||||
# Generate assets and build with optimizations
|
# Generate assets and build with optimizations
|
||||||
SHELL ["/bin/bash", "-c"]
|
RUN set -eux; \
|
||||||
RUN cd /app && make generate && \
|
cd /app; \
|
||||||
|
make generate; \
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
-ldflags='-s -w -extldflags "-static"' \
|
-ldflags='-s -w -extldflags "-static"' \
|
||||||
-tags netgo,osusergo \
|
-tags netgo,osusergo \
|
||||||
|
@ -29,7 +26,6 @@ RUN cd /app && make generate && \
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
# Copy static files and assets
|
# 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 /app/docs /docs
|
||||||
COPY --from=builder /go/bin/app /app
|
COPY --from=builder /go/bin/app /app
|
||||||
|
|
||||||
|
|
11
Makefile
11
Makefile
|
@ -44,27 +44,28 @@ ensure-swag:
|
||||||
go install github.com/swaggo/swag/cmd/swag@latest; \
|
go install github.com/swaggo/swag/cmd/swag@latest; \
|
||||||
}
|
}
|
||||||
|
|
||||||
reset:
|
reset: docker-clean
|
||||||
@echo "$(CLEAN) Performing complete project reset..."
|
@echo "$(CLEAN) Performing complete project reset..."
|
||||||
@rm -f $(BINARY_NAME)
|
@rm -f $(BINARY_NAME)
|
||||||
@rm -rf public/css/styles.css
|
|
||||||
@rm -rf docs/docs.go docs/swagger.json docs/swagger.yaml
|
@rm -rf docs/docs.go docs/swagger.json docs/swagger.yaml
|
||||||
@go clean -cache -testcache -modcache
|
@go clean -cache -testcache -modcache
|
||||||
@rm -rf $(BASE_PATH)/tw # Remove the 'tw' directory
|
|
||||||
@echo "$(CHECK) Project reset complete"
|
@echo "$(CHECK) Project reset complete"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "$(CLEAN) Cleaning build artifacts..."
|
@echo "$(CLEAN) Cleaning build artifacts..."
|
||||||
@rm -f $(BINARY_NAME)
|
@rm -f $(BINARY_NAME)
|
||||||
@rm -f public/css/styles.css
|
|
||||||
@echo "$(CHECK) Cleanup complete"
|
@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
|
swaggergen: ensure-swag
|
||||||
@echo "$(DOCS) Generating Swagger documentation..."
|
@echo "$(DOCS) Generating Swagger documentation..."
|
||||||
@swag init
|
@swag init
|
||||||
@echo "$(CHECK) Swagger docs generated"
|
@echo "$(CHECK) Swagger docs generated"
|
||||||
|
|
||||||
# Combined generation target
|
|
||||||
generate: swaggergen
|
generate: swaggergen
|
||||||
|
|
||||||
build: generate
|
build: generate
|
||||||
|
|
|
@ -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!
|
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.
|
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.
|
I hope you found this helpful! This will be periodically updated to avoid outdated recommendations.
|
||||||
|
|
||||||
```javascript
|
|
||||||
let x = 2;
|
|
||||||
console.log(x);
|
|
||||||
```
|
|
||||||
## H2
|
|
||||||
### H3
|
|
3
main.go
3
main.go
|
@ -20,6 +20,9 @@ import (
|
||||||
//go:embed public/*
|
//go:embed public/*
|
||||||
var PublicFS embed.FS
|
var PublicFS embed.FS
|
||||||
|
|
||||||
|
//go:embed docs/*
|
||||||
|
var DocsFS embed.FS
|
||||||
|
|
||||||
// @title Atri.dad API
|
// @title Atri.dad API
|
||||||
// @version 1.0
|
// @version 1.0
|
||||||
// @description This is the API for atri.dad
|
// @description This is the API for atri.dad
|
||||||
|
|
Loading…
Add table
Reference in a new issue