-
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.
updated(task_manager_api): dockernized the application
- Loading branch information
Showing
9 changed files
with
91 additions
and
9 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
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,2 +1,3 @@ | ||
.env | ||
coverage.out | ||
coverage.out | ||
temp/ |
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: "3.8" | ||
|
||
services: | ||
mongodb: | ||
image: mongo:latest | ||
container_name: mongo | ||
ports: | ||
- "27017:27017" | ||
volumes: | ||
- mongo-data:/data/db | ||
networks: | ||
- app-network | ||
|
||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: task-manager | ||
ports: | ||
- "8081:8081" | ||
depends_on: | ||
- mongodb | ||
environment: | ||
MONGO_URL: "mongodb://mongo:27017/task_manager" | ||
MONGO_DATABASE: "task_manager" | ||
SERVER_ADDRESS: ":8081" | ||
USER_COLLECTION: "users" | ||
JWT_SECRET: "b37df767fedf114b3f326deb59fa27f1b7bcc1c94a4f99a6b5f7423165b5fb0d" | ||
ALLOWED_USERS: "admin" | ||
TASK_COLLECTION: "tasks" | ||
TEST_DATABASE: "test_db" | ||
TEST_USER_COLLECTION: "user_test" | ||
TEST_TASK_COLLECTION: "task_test" | ||
networks: | ||
- app-network | ||
|
||
networks: | ||
app-network: | ||
driver: bridge | ||
|
||
volumes: | ||
mongo-data: |
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,32 @@ | ||
# Use an official Go runtime as a parent image | ||
FROM golang:1.22-alpine AS builder | ||
|
||
# Set the Current Working Directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the Go Modules manifests | ||
COPY go.mod go.sum ./ | ||
|
||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed | ||
RUN go mod download | ||
|
||
# Copy the source code into the container | ||
COPY . . | ||
|
||
# Build the Go app | ||
RUN go build -o bin/task-manager ./Delivery/main.go | ||
|
||
# Use a minimal base image to run the Go app | ||
FROM alpine:latest | ||
|
||
# Set the Current Working Directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the binary from the builder stage | ||
COPY --from=builder /app/bin/task-manager . | ||
|
||
# Expose port 8081 to the outside world | ||
EXPOSE 8081 | ||
|
||
# Run the binary program produced by `go build` | ||
CMD ["./task-manager"] |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
exit status 1 |