add docker
This commit is contained in:
36
.dockerignore
Normal file
36
.dockerignore
Normal file
@@ -0,0 +1,36 @@
|
||||
# Docker Ignore File
|
||||
.git
|
||||
.gitignore
|
||||
README.md
|
||||
*.md
|
||||
*.log
|
||||
.txt
|
||||
.env
|
||||
.env.*
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
vendor/
|
||||
bin/
|
||||
tmp/
|
||||
temp/
|
||||
dist/
|
||||
coverage/
|
||||
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Loại trừ các file tạm thời và biên dịch
|
||||
test/
|
||||
tests/
|
||||
*.test
|
||||
*_test.go
|
||||
|
||||
# Loại trừ các file cấu hình IDE
|
||||
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.25.6-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-s -w" -o main ./cmd/api
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /app/main /main
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/main"]
|
||||
Reference in New Issue
Block a user