add dockerfile
This commit is contained in:
parent
a69cd3f44c
commit
5f03b8ad6d
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.git
|
||||||
|
config.y*ml
|
||||||
|
go.work*
|
||||||
|
docker-compose-sample*
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
FROM golang:1-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV GO111MODULE=auto CGO_ENABLED=0 GOOS=linux
|
||||||
|
|
||||||
|
ARG GOPROXY
|
||||||
|
ARG GONOSUMDB=gitea.libretechconsulting.com
|
||||||
|
ARG VER_PKG=gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version
|
||||||
|
ARG VERSION=(devel)
|
||||||
|
ARG APP_NAME=demo-app
|
||||||
|
|
||||||
|
COPY ./go.mod ./go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY ./ /app
|
||||||
|
RUN go build -C . -v -ldflags "-extldflags '-static' -X ${VER_PKG}=${VERSION}" -o ${APP_NAME} .
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
ARG APP_NAME=demo-app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
USER 100:101
|
||||||
|
|
||||||
|
COPY --from=build --chown=100:101 /app/${APP_NAME} /app/
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/app/${APP_NAME}" ]
|
Loading…
x
Reference in New Issue
Block a user