diff --git a/Jenkinsfile b/Jenkinsfile index 6b17f65..510730f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,20 +1,22 @@ pipeline { -agent { - docker { - image 'golang:1.23-alpine' - } - } + agent any stages { - stage('Install deps') { + stage('Install') { + agent { + docker { + image 'golang:1.23-alpine' + reuseNode true + } + } steps { sh 'go mod tidy' - } - } - stage('Build binary') { - steps { sh 'go build main.go' } } + stage('Populate env') { + sh 'rm .env || true' + sh 'echo "PORT=8007" > .env' + } stage('Profit') { steps { dir('docker') { diff --git a/docker/Dockerfile b/docker/Dockerfile index 596b169..70baeb5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,6 +2,7 @@ FROM alpine:3 COPY ../main . COPY ../public . +COPY ../.env . CMD ["main"]