Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker #135

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM eclipse-temurin:17-jdk-focal

WORKDIR /app

COPY .mvn/ .mvn
COPY mvnw pom.xml ./
RUN ./mvnw dependency:go-offline

COPY src ./src

CMD ["./mvnw", "spring-boot:run"]
29 changes: 29 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pipeline {
agent any

stages {
stage('Build') {
steps {
sh 'docker build -t ecommerce:latest .'
}
}

stage('Cleaning') {
steps {
script {
def containerId = sh(returnStdout: true, script: 'docker ps -aqf "name=ecommerce"').trim()
if (containerId) {
sh "docker stop $containerId"
sh "docker rm $containerId"
}
}
}
}

stage('Run') {
steps {
sh 'docker run --name ecommerce --network yan --restart=unless-stopped -d ecommerce:latest'
}
}
}
}
6 changes: 3 additions & 3 deletions database/jira.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-- dispose db

DROP DATABASE IF EXISTS jira_project;
DROP DATABASE IF EXISTS ecommerce;

-- create db

CREATE DATABASE IF NOT EXISTS jira_project;
CREATE DATABASE IF NOT EXISTS ecommerce;

-- use db

USE jira_project;
USE ecommerce;

-- fix default

Expand Down
Loading