loginsrv

Unnamed repository; edit this file 'description' to name the repository.
git clone git@jamesshield.xyz:repos/loginsrv.git
Log | Files | Refs | README | LICENSE

commit 0dcf52cd564a4737a9e862ed208a71365b82796c
parent 128c9e40a05cf3c2456f6aba7343ca1b58cefc1a
Author: Gregor Weckbecker <gregor.weckbecker@snabble.io>
Date:   Mon,  6 Jan 2020 14:49:47 +0100

Merge pull request #159 from kernle32dll/build-in-docker

Move binary build into dockerfile
Diffstat:
A.dockerignore | 3+++
MDockerfile | 24++++++++++++++++++++++--
Mdocker_push.sh | 1-
3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/.dockerignore b/.dockerignore @@ -0,0 +1,2 @@ +.git +Dockerfile+ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile @@ -1,8 +1,27 @@ -FROM alpine +FROM golang:1.13-alpine3.11 as builder +RUN apk --update --no-cache add g++ + +WORKDIR /build + +# Cache dependencies +COPY go.mod go.mod +COPY go.sum go.sum +RUN go mod download + +# Copy code +COPY . . + +RUN go build -a --ldflags '-linkmode external -extldflags "-static"' . + +# ---------- + +FROM alpine:3.11 RUN apk --update --no-cache add ca-certificates \ && addgroup -S loginsrv && adduser -S -g loginsrv loginsrv USER loginsrv + ENV LOGINSRV_HOST=0.0.0.0 LOGINSRV_PORT=8080 -COPY loginsrv / ENTRYPOINT ["/loginsrv"] EXPOSE 8080 + +COPY --from=builder /build/loginsrv /+ \ No newline at end of file diff --git a/docker_push.sh b/docker_push.sh @@ -1,6 +1,5 @@ #!/bin/bash -GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static"' . ; docker build -t tarent/loginsrv . ; docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" ; docker push tarent/loginsrv ;