Skip to content

Commit 87571ec

Browse files
author
Maksim Vlasov
committed
Add Dokerfile. Add docker-compose.yml for local deploy. Expose 8080 port locally.
1 parent 2fa7939 commit 87571ec

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM openjdk:8-jdk-alpine
2+
3+
COPY ./target/java-getting-started-1.0.jar java-getting-started-1.0.jar
4+
5+
# Run the image as a non-root user
6+
RUN adduser -D myuser
7+
USER myuser
8+
9+
EXPOSE 8080
10+
11+
CMD java $JAVA_OPTS -jar java-getting-started-1.0.jar

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3'
2+
services:
3+
db:
4+
image: postgres:9.6
5+
environment:
6+
POSTGRES_PASSWORD: postgres
7+
ports:
8+
- 5432:5432
9+
app:
10+
build: .
11+
ports:
12+
- 8080:8080
13+
environment:
14+
- JDBC_DATABASE_URL=jdbc:postgresql://db:5432/postgres
15+
- DATABASE_USERNAME=postgres
16+
- DATABASE_PASSWORD=postgres
17+
- PORT=8080

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ logging.level.org.springframework=INFO
99

1010
spring.profiles.active=production
1111

12-
server.port=${PORT:5000}
12+
server.port=${PORT:8080}

0 commit comments

Comments
 (0)