build: Add Dockerfile and dockerignore
This commit is contained in:
parent
8d6889ce08
commit
188b7905f5
2 changed files with 32 additions and 0 deletions
12
.dockerignore
Normal file
12
.dockerignore
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
.git
|
||||
.gitignore
|
||||
.env
|
||||
.env.example
|
||||
.air.toml
|
||||
main
|
||||
tmp/
|
||||
build-errors.log
|
||||
README.md
|
||||
todo.txt
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM golang:1.24-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/bin/server ./cmd
|
||||
|
||||
FROM alpine:3.23
|
||||
RUN apk add --no-cache ca-certificates
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/bin/server ./server
|
||||
COPY --from=build /app/ui ./ui
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["./server"]
|
||||
Loading…
Reference in a new issue