Use a single container for build & run
This commit is contained in:
parent
e68245273d
commit
0dbe8344dd
13
Dockerfile
13
Dockerfile
@ -1,6 +1,15 @@
|
||||
FROM debian:bookworm
|
||||
FROM golang:1.22
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download && go mod verify
|
||||
|
||||
COPY . .
|
||||
RUN go build
|
||||
|
||||
EXPOSE 8080:8080
|
||||
|
||||
# Copy the backend binary
|
||||
COPY ./card-jong-be .
|
||||
ENTRYPOINT ["card-jong-be"]
|
||||
CMD ["card-jong-be"]
|
||||
|
13
Jenkinsfile
vendored
13
Jenkinsfile
vendored
@ -2,18 +2,7 @@ pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Build binary') {
|
||||
agent {
|
||||
docker {
|
||||
image "golang:1.22-bookworm"
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh 'go build'
|
||||
}
|
||||
}
|
||||
stage("Deploy") {
|
||||
stage("Run & build") {
|
||||
steps {
|
||||
sh "docker compose up --build -d"
|
||||
}
|
||||
|
@ -5,4 +5,3 @@ services:
|
||||
build: .
|
||||
ports:
|
||||
- "9126:8080"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user