Use multi stage build
This commit is contained in:
parent
082084dd13
commit
8c4a434afd
19
Dockerfile
19
Dockerfile
|
@ -1,16 +1,29 @@
|
|||
FROM golang AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./src /app/src
|
||||
COPY ./go.mod /app
|
||||
COPY ./go.sum /app
|
||||
|
||||
RUN go build -o /app/main /app/src/main.go
|
||||
RUN go build -o /app/cmd /app/src/cmd.go
|
||||
|
||||
ARG JAVA_VERSION=16
|
||||
FROM openjdk:${JAVA_VERSION}
|
||||
FROM openjdk:16
|
||||
|
||||
ENV MIN_MEM=512M
|
||||
ENV MAX_MEM=1G
|
||||
ENV STOP="stop"
|
||||
ENV JAR=server.jar
|
||||
|
||||
COPY ./bin/main /main
|
||||
COPY ./bin/cmd /usr/local/bin/cmd
|
||||
COPY --from=builder /app/main /main
|
||||
COPY --from=builder /app/cmd /usr/local/bin/cmd
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
VOLUME [ "/server" ]
|
||||
|
||||
WORKDIR /server
|
||||
|
||||
ENTRYPOINT [ "/main" ]
|
||||
|
|
Loading…
Reference in New Issue