Browse Source

dockerfile fix

master
Vladimir Smagin 3 weeks ago
parent
commit
dff6035456
2 changed files with 12 additions and 3 deletions
  1. +10
    -1
      Dockerfile
  2. +2
    -2
      Jenkinsfile

+ 10
- 1
Dockerfile View File

@@ -1,5 +1,14 @@
FROM golang:1.14

COPY ./compare-pg /usr/bin/compare-pg
RUN apt-update && apt install -y git mercurial

WORKDIR /app
COPY . .

RUN go build -mod vendor -o myapp

FROM ubuntu:20.04

COPY --from=0 /app/myapp /usr/bin/compare-pg

ENTRYPOINT /usr/bin/compare-pg

+ 2
- 2
Jenkinsfile View File

@@ -8,11 +8,11 @@ node {
def image_name = "${repository}:${tag}"

stage("Tests") {
sh "docker run --rm -v jenkins_jenkins-data:/var/jenkins_home golang:1.14 /bin/sh -c 'cd ${WORKSPACE} && CGO_ENABLED=0 go test -mod vendor -v ./...'"
sh "docker run --rm -v jenkins_jenkins-data:/var/jenkins_home golang:1.14 /bin/sh -c 'cd ${WORKSPACE} && go test -mod vendor -v ./...'"
}

stage("Build binary") {
sh "docker run --rm -v jenkins_jenkins-data:/var/jenkins_home golang:1.14 /bin/sh -c 'cd ${WORKSPACE} && CGO_ENABLED=0 go build -mod vendor -ldflags \"-w -s\"'"
sh "docker run --rm -v jenkins_jenkins-data:/var/jenkins_home golang:1.14 /bin/sh -c 'cd ${WORKSPACE} && go build -mod vendor'"
}

stage("Build image") {


Loading…
Cancel
Save