-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from CS3219-AY2425S1/frontend-docker-vol-binding
Add Docker support
- Loading branch information
Showing
83 changed files
with
5,446 additions
and
421 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
**/.env |
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,3 @@ | ||
MONGODB_URI=mongodb+srv://<user>:<password>@<collection>.<name>.mongodb.net/?retryWrites=true&w=majority&appName=<appname> | ||
PORT=:9090 | ||
CORS_ORIGIN=http://localhost:3000 |
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,2 @@ | ||
questionDB.env | ||
.env | ||
log |
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,29 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM golang:1.23 | ||
|
||
# Set destination for COPY | ||
WORKDIR /backend | ||
|
||
# Download Go modules | ||
# TODO: don't include the .env file in the COPY | ||
# TODO: multistage build | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
# Copy the source code. Note the slash at the end, as explained in | ||
# https://docs.docker.com/reference/dockerfile/#copy | ||
COPY . . | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /backend/app | ||
|
||
# Optional: | ||
# To bind to a TCP port, runtime parameters must be supplied to the docker command. | ||
# But we can document in the Dockerfile what ports | ||
# the application is going to listen on by default. | ||
# https://docs.docker.com/reference/dockerfile/#expose | ||
EXPOSE 9090 | ||
|
||
# Run | ||
CMD ["/backend/app"] |
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,22 +1,19 @@ | ||
// defines the JSON format of quesitons. | ||
package common | ||
|
||
type Difficulty int | ||
|
||
const ( | ||
Easy Difficulty = 1 | ||
Medium Difficulty = 2 | ||
Hard Difficulty = 3 | ||
) | ||
|
||
// Question struct | ||
type Question struct { | ||
ID int `json:"id"` | ||
Difficulty Difficulty `json:"difficulty"` | ||
Title string `json:"title"` | ||
Description string `json:"description"` | ||
Categories []string `json:"categories"` | ||
TestCases map[string]string `json:"test_cases"` | ||
//Images []string `json:"images"` // for future uses | ||
Title string `json:"title"` | ||
TitleSlug string `json:"titleSlug"` | ||
Difficulty string `json:"difficulty"` | ||
TopicTags []string `json:"topicTags"` | ||
Content string `json:"content"` | ||
Schemas []string `json:"schemas"` | ||
Id int `json:"id"` | ||
} | ||
|
||
type FrontendQuestion struct { | ||
Title string `json:"title"` | ||
Difficulty string `json:"difficulty"` | ||
TopicTags []string `json:"topicTags"` | ||
Content string `json:"content"` | ||
} |
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
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
Oops, something went wrong.