-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tiago Góes <[email protected]>
- Loading branch information
1 parent
3427988
commit 05b16d4
Showing
6 changed files
with
53 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.DS_Store | ||
todo-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM golang:1.22 | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN go mod download | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o todo-api cmd/main.go | ||
|
||
WORKDIR /app | ||
|
||
EXPOSE 8080 | ||
|
||
RUN chmod +x todo-api | ||
|
||
CMD [ "./todo-api" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,6 @@ func main() { | |
}) | ||
}) | ||
|
||
server.Run(":8000") | ||
server.Run(":8080") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,37 @@ | ||
# Use postgres/example user/password credentials | ||
version: '3.9' | ||
|
||
services: | ||
api: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
restart: always | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
DATABASE_URL: postgres://postgres:1234@db:5432/postgres?sslmode=disable | ||
GIN_MODE: release | ||
depends_on: | ||
- db | ||
networks: | ||
- todo-network | ||
|
||
db: | ||
image: postgres | ||
container_name: database | ||
restart: always | ||
ports: | ||
- "5432:5432" | ||
- "5432:5432" | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
- pgdata:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_PASSWORD: 1234 | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
networks: | ||
- todo-network | ||
|
||
volumes: | ||
pgdata: {} | ||
pgdata: {} | ||
|
||
networks: | ||
todo-network: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module todo-api | ||
|
||
go 1.22.6 | ||
go 1.22.5 | ||
|
||
require ( | ||
github.com/gin-gonic/gin v1.10.0 | ||
|