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

Dockerizing app & docker-compose for elasticsearch container #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Basic Template Dockerfile
FROM openjdk:8-jdk-alpine

ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar

ENTRYPOINT ["java","-jar","/app.jar"]
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.8"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.6
container_name: elasticsearch
restart: unless-stopped
ports:
- "9200:9200"
- "9300:9300"
environment:
cluster.name: elasticsearch
discovery.type: single-node
bootstrap.memory_lock: "true"
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: "curl -f http://localhost:9200 || exit 1"
start_period: 1m

# elastic-boot:
# container_name: elastic-boot-container
# build:
# context: ./
# dockerfile: Dockerfile
# ports:
# - "8090:8090"
# depends_on: # Start the depends_on first
# - elasticsearch
# healthcheck:
# test: "wget --quiet --tries=1 --spider http://localhost:8090 || exit 1"
# restart: unless-stopped

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
import java.util.stream.Collectors;

@Service
@RequiredArgsConstructor
public class UserService {

@Autowired
private UserRepository userRepository;

@Autowired
private ElasticsearchOperations elasticsearchOperations;

Expand Down