Use a single container for build & run

This commit is contained in:
Araozu 2024-05-08 09:34:07 -05:00
parent e68245273d
commit 0dbe8344dd
3 changed files with 12 additions and 15 deletions

View File

@ -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
View File

@ -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"
}

View File

@ -5,4 +5,3 @@ services:
build: .
ports:
- "9126:8080"