generated from CodeChefVIT/template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0a1aa1
commit 10f06a7
Showing
42 changed files
with
260 additions
and
3,933 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
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,27 @@ | ||
## icETITE-24 API | ||
|
||
### Documentation | ||
For detailed information on how to use the project's API, please refer to the [Postman Documentation](). | ||
|
||
|
||
### Getting Started | ||
|
||
Clone the repository: | ||
|
||
``git clone https://github.com/CodeChefVIT/cookoff-backend`` | ||
|
||
Install Make, Docker and Docker Compose 2.0 if not already installed. | ||
|
||
Run the following commands in the project root directory: | ||
|
||
```` | ||
make help # Get All The Make Commands Supported | ||
make build # Build Docker containers | ||
make up # Start Docker containers in the background | ||
```` | ||
|
||
*** | ||
Your API will be running on http://localhost:80 | ||
|
||
Test whether API is up at http://localhost/api/v1/healthcheck | ||
*** |
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,22 +1,20 @@ | ||
# Use an official Node.js runtime as the base image | ||
FROM --platform=linux/amd64 node:18 | ||
# Set the working directory inside the container | ||
WORKDIR /usr/src/app | ||
FROM golang:alpine | ||
|
||
# Copy package.json and package-lock.json to the container | ||
COPY package*.json ./ | ||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache git | ||
|
||
# Install app dependencies | ||
RUN npm install | ||
RUN mkdir /app | ||
|
||
# Copy the rest of the app's source code to the container | ||
COPY . . | ||
WORKDIR /app | ||
|
||
# Expose the port that the app will run on | ||
EXPOSE 8080 | ||
ADD go.mod . | ||
ADD go.sum . | ||
|
||
RUN go mod download | ||
ADD . . | ||
|
||
# Install PM2 globally | ||
RUN npm install pm2 -g | ||
RUN go build -o ./bin/cookoff-backend ./cmd/main.go | ||
|
||
EXPOSE 8080 | ||
|
||
# Use PM2 as the command to run the app, with automatic restart on failure | ||
CMD ["pm2-runtime", "index.js"] | ||
CMD ["./bin/cookoff-backend"] |
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,35 @@ | ||
# Define variables | ||
DOCKER_COMPOSE = docker compose | ||
|
||
# Targets | ||
.PHONY: build up down logs restart clean | ||
|
||
build: | ||
$(DOCKER_COMPOSE) build | ||
|
||
up: | ||
$(DOCKER_COMPOSE) up -d | ||
|
||
down: | ||
$(DOCKER_COMPOSE) down | ||
|
||
logs: | ||
$(DOCKER_COMPOSE) logs -f | ||
|
||
restart: | ||
$(DOCKER_COMPOSE) restart | ||
|
||
clean: | ||
$(DOCKER_COMPOSE) down -v | ||
|
||
# Help target | ||
help: | ||
@echo "Usage: make [target]" | ||
@echo "Targets:" | ||
@echo " build Build Docker containers" | ||
@echo " up Start Docker containers in the background" | ||
@echo " down Stop and remove Docker containers" | ||
@echo " logs View logs of Docker containers" | ||
@echo " restart Restart Docker containers" | ||
@echo " clean Stop, remove containers, and also remove volumes (data)" | ||
@echo " help Display this help message" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.