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 && \
|
||||
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
|
||||
|
||||
|
|
11
Makefile
11
Makefile
|
@ -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
|
||||
|
|
|
@ -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.
|
3
main.go
3
main.go
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue