Skip to content

Commit f2a09a0

Browse files
authored
Merge pull request #18 from vitekkor/#6_dockerfile
#6 dockerfile
2 parents 62364d4 + 55e6756 commit f2a09a0

File tree

4 files changed

+59
-12
lines changed

4 files changed

+59
-12
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM gradle:7.6.0-jdk11-alpine
2+
WORKDIR /vitekkor/frogapi
3+
COPY . .
4+
RUN gradle clean bootJar
5+
6+
FROM openjdk:11-jre-slim
7+
WORKDIR /vitekkor/frogapi
8+
COPY --from=0 /vitekkor/frogapi/images ./images
9+
COPY --from=0 /vitekkor/frogapi/build/libs/frog-api-1.0-SNAPSHOT.jar .
10+
EXPOSE 8080:8080
11+
CMD java -jar frog-api-1.0-SNAPSHOT.jar --spring.config.location=classpath:/application.yml,optional:/etc/vitekkor/frogapi/application.yml

docker-compose.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: '3'
2+
services:
3+
frog-api-service:
4+
build:
5+
context: .
6+
volumes:
7+
- /etc/vitekkor/frogapi/application.yml:/etc/vitekkor/frogapi/application.yml
8+
restart: always
9+
ports:
10+
- "8080:8080"
11+
network_mode: host
12+
depends_on:
13+
- db
14+
- s3
15+
db:
16+
image: postgres:15
17+
restart: always
18+
environment:
19+
POSTGRES_DB: frogapi
20+
POSTGRES_PASSWORD:
21+
volumes:
22+
- /var/lib/postgresql/data:/var/lib/postgresql/data
23+
ports:
24+
- "5432:5432"
25+
healthcheck:
26+
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
27+
interval: 30s
28+
timeout: 30s
29+
retries: 3
30+
s3:
31+
image: minio/minio:edge
32+
restart: always
33+
environment:
34+
MINIO_ROOT_USER:
35+
MINIO_ROOT_PASSWORD:
36+
ports:
37+
- "9000:9000"
38+
- "9001:9001"
39+
command: server /data --console-address ":9001"
40+
volumes:
41+
- /var/lib/minio:/data
42+
healthcheck:
43+
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
44+
interval: 30s
45+
timeout: 20s
46+
retries: 3

src/main/kotlin/com/vitekkor/frogapi/FrogApiApplication.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ import org.springframework.boot.runApplication
1010
@SpringBootApplication
1111
class FrogApiApplication
1212

13-
object Dev {
14-
@JvmStatic
15-
fun main(args: Array<String>) {
16-
System.setProperty("spring.profiles.active", "dev")
17-
System.setProperty("log.dir", "frog-api/logs")
18-
19-
com.vitekkor.frogapi.main(args)
20-
}
21-
}
22-
2313
fun main(args: Array<String>) {
2414
runApplication<FrogApiApplication>(*args)
25-
}
15+
}

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ minio:
3737
accessKey:
3838
secretKey:
3939
bucket:
40-
autoCreation:
40+
autoCreation: true
4141

4242
logging:
4343
file:

0 commit comments

Comments
 (0)