Skip to content

Commit

Permalink
cleanup Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
akokshar committed Oct 2, 2019
1 parent 1f846cb commit f16a48d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
FROM golang:latest as builder
COPY . .
RUN CGO_ENABLED=0 go build -o /app .
# FROM golang:latest as builder

# RUN go version
# RUN pwd
# COPY . .
# RUN ls
# RUN CGO_ENABLED=0 go build -o /app .

FROM scratch
COPY --from=builder /app /

COPY app /

ENTRYPOINT ["/app"]
33 changes: 22 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pipeline {

agent {
kubernetes {
defaultContainer 'jnlp'
Expand All @@ -21,7 +22,7 @@ spec:
imagePullPolicy: Never
env:
- name: DOCKER_HOST
value: tcp://docker.devops.svc:2375
value: tcp://docker:2375
command:
- cat
tty: true
Expand All @@ -30,25 +31,35 @@ spec:
}

stages {
stage('Test') {
steps {
sh 'pwd'
sh 'env'
}
}

// stage('Checks...') {
// steps {
// script {
// def e = env.getEnvironment()
// e.each { k, v ->
// println("${k} = '${v}'")
// }
// }
// }
// }

stage('Build') {
steps {
container('golang') {
sh 'pwd'
sh 'ls -la'
sh 'id'
sh 'CGO_ENABLED=0 GOCACHE=/tmp go build -o app .'
withEnv([
'CGO_ENABLED=0',
'GOCACHE=/tmp'
]) {
sh 'go test ./...'
sh 'go build -o app .'
}
}
container('docker-cli') {
sh '/docker build -t devops:${BRANCH_NAME} .'
}
}
}

stage('Deploy') {
steps {
sh 'echo Deploy'
Expand Down

0 comments on commit f16a48d

Please sign in to comment.