From e2be83ce243b31cc85927506fac3b34442a95ce1 Mon Sep 17 00:00:00 2001 From: Araozu Date: Sun, 6 Oct 2024 20:41:11 -0500 Subject: [PATCH] feat: create docker files for deployment --- Jenkinsfile | 12 +++++------- docker/Dockerfile | 7 +++++++ docker/docker-compose.yml | 9 +++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml diff --git a/Jenkinsfile b/Jenkinsfile index 66f79fc..6b17f65 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent { docker { - image 'golang:1.23' + image 'golang:1.23-alpine' } } stages { @@ -15,14 +15,12 @@ agent { sh 'go build main.go' } } - stage('???') { - steps { - sh 'echo "TODO: call docker compose up"' - } - } stage('Profit') { steps { - sh 'echo "done"' + dir('docker') { + sh 'docker compose stop || true' + sh 'docker compose up --build -d' + } } } } diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..596b169 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3 + +COPY ../main . +COPY ../public . + +CMD ["main"] + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..5a16eff --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,9 @@ +services: + dev.araozu.music: + container_name: music-to-go + build: + context: . + dockerfile: Dockerfile + ports: + - "8007:8007" + restart: unless-stopped