Skip to content

Commit 1bbfa72

Browse files
chore: inicializando repositorio curso docker
0 parents  commit 1bbfa72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1659
-0
lines changed

Diff for: .gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/

Diff for: .mvn/wrapper/maven-wrapper.jar

58.5 KB
Binary file not shown.

Diff for: .mvn/wrapper/maven-wrapper.properties

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

Diff for: Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM alpine:latest
2+
RUN apk add --no-cache openjdk17-jre
3+
WORKDIR /app
4+
ENV JAR_NAME=algatransito-api.jar
5+
COPY target/$JAR_NAME $JAR_NAME
6+
CMD java -jar $JAR_NAME

Diff for: docker-compose-v1.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
mysql:
3+
image: mysql:8.0
4+
container_name: mysql
5+
environment:
6+
MYSQL_ROOT_PASSWORD: root
7+
MYSQL_DATABASE: algatransito
8+
MYSQL_USER: alga
9+
MYSQL_PASSWORD: 123456
10+
ports:
11+
- "3306:3306"
12+
networks:
13+
- mysql-network
14+
15+
networks:
16+
mysql-network:
17+
driver: bridge

Diff for: docker-compose-v2.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
algatransito-api:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
container_name: algatransito-api
7+
environment:
8+
DB_HOST: mysql
9+
ports:
10+
- "8080:8080"
11+
depends_on:
12+
- mysql
13+
networks:
14+
- algatransito-network
15+
16+
mysql:
17+
image: mysql:8.0
18+
container_name: mysql
19+
environment:
20+
MYSQL_ROOT_PASSWORD: root
21+
MYSQL_DATABASE: algatransito
22+
MYSQL_USER: alga
23+
MYSQL_PASSWORD: 123456
24+
ports:
25+
- "3306:3306"
26+
networks:
27+
- algatransito-network
28+
29+
networks:
30+
algatransito-network:
31+
driver: bridge

Diff for: docker-compose-v3.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
services:
2+
algatransito-api:
3+
build:
4+
context: .
5+
dockerfile: multistage.Dockerfile
6+
container_name: algatransito-api
7+
environment:
8+
DB_HOST: mysql
9+
ports:
10+
- "8080:8080"
11+
depends_on:
12+
- mysql
13+
# caso tenha PROBLEMAS com ordem de execucao, descomentar o depends_on com condicao Healthy
14+
# mysql:
15+
# condition: service_healthy
16+
networks:
17+
- algatransito-network
18+
19+
mysql:
20+
image: mysql:8.0
21+
container_name: mysql
22+
environment:
23+
MYSQL_ROOT_PASSWORD: root
24+
MYSQL_DATABASE: algatransito
25+
MYSQL_USER: alga
26+
MYSQL_PASSWORD: 123456
27+
ports:
28+
- "3306:3306"
29+
networks:
30+
- algatransito-network
31+
# caso tenha PROBLEMAS com ordem de execucao, descomentar o Healthcheck
32+
# healthcheck:
33+
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$$MYSQL_ROOT_PASSWORD"]
34+
# interval: 5s
35+
# timeout: 5s
36+
# retries: 5
37+
# start_period: 10s
38+
39+
networks:
40+
algatransito-network:
41+
driver: bridge

Diff for: multistage.Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Build stage
2+
FROM maven:3.8.4-openjdk-17-slim AS build
3+
WORKDIR /app
4+
COPY . .
5+
RUN mvn clean package -DskipTests
6+
7+
# Run stage
8+
FROM openjdk:17-slim
9+
WORKDIR /app
10+
ENV JAR_NAME=algatransito-api.jar
11+
COPY --from=build /app/target/$JAR_NAME $JAR_NAME
12+
EXPOSE 8080
13+
CMD java -jar $JAR_NAME

0 commit comments

Comments
 (0)