Andrey Kovalev
3 years ago
1 changed files with 17 additions and 6 deletions
@ -1,13 +1,24 @@ |
|||||||
FROM golang:1.18 |
# Build container |
||||||
|
FROM golang:1.18-bullseye AS build |
||||||
|
|
||||||
# Set app workdir |
# Set build workdir |
||||||
WORKDIR /go/src/app |
WORKDIR /app |
||||||
|
|
||||||
# Copy application sources |
# Copy app sources |
||||||
COPY . . |
COPY . . |
||||||
|
|
||||||
# Build app |
# Build app |
||||||
RUN go build -o app . |
RUN go build -o bin . |
||||||
|
|
||||||
|
# --- |
||||||
|
# Production container |
||||||
|
FROM debian:bullseye-slim |
||||||
|
|
||||||
|
# Set app workdir |
||||||
|
WORKDIR /app |
||||||
|
|
||||||
|
# Copy binary |
||||||
|
COPY --from=build /app/bin . |
||||||
|
|
||||||
# Run app |
# Run app |
||||||
CMD ["./app"] |
CMD ["./bin"] |
||||||
|
Loading…
Reference in new issue