v1.0.0: docker: add docker file
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
1d75617c46
commit
2e2279f3c8
1 changed files with 24 additions and 0 deletions
24
Dockerfile
Normal file
24
Dockerfile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
FROM golang:1.21-alpine AS develop
|
||||
|
||||
# Changement du répertoire de travail
|
||||
WORKDIR /app
|
||||
|
||||
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download && go mod verify
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["sh", "-c", "echo 'run application' && go run ./cmd/"]
|
||||
|
||||
FROM develop AS build
|
||||
|
||||
RUN CGO_ENABLED=0 go build -o ./build/app ./cmd/
|
||||
|
||||
FROM scratch AS release
|
||||
|
||||
COPY --from=build /app/build/app /exec
|
||||
|
||||
EXPOSE 1222
|
||||
|
||||
ENTRYPOINT ["/exec"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue