Skip to content

Commit 92da502

Browse files
committed
Dockerise question service and gitignore staging firebase
1 parent b7ba663 commit 92da502

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

apps/question-service/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Ignore private key json file
22
cs3219-g24-firebase-adminsdk-9cm7h-b1675603ab.json
3+
cs3219-g24-staging-firebase-adminsdk-suafv-9c0d1b2299.json
34
test_create_api_results.txt
45
test_list_api_results.txt
56
test_update_api_results.txt

apps/question-service/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:1.23
2+
3+
WORKDIR /usr/src/app
4+
5+
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
6+
COPY go.mod go.sum ./
7+
RUN go mod tidy && go mod download && go mod verify
8+
9+
COPY . .
10+
11+
RUN go build -v -o /usr/local/bin/app ./main.go
12+
13+
EXPOSE 8080
14+
15+
CMD ["app"]

apps/question-service/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ go run main.go
4949

5050
The server will be available at http://localhost:8080.
5151

52+
## Running the Application via Docker
53+
54+
To run the application via Docker, run the following command:
55+
56+
```bash
57+
docker build -t question-service .
58+
```
59+
60+
```bash
61+
docker run -p 8080:8080 -d question-service
62+
```
63+
64+
The server will be available at http://localhost:8080.
65+
5266
## API Endpoints
5367

5468
- `POST /questions`

0 commit comments

Comments
 (0)