diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..8a058f781 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,14 @@ +name: simple-fortune-cookie +on: + push +jobs: + Test: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Test Frontend + working-directory: frontend + run: go test ./... + diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 000000000..0b7be642b --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,6 @@ +FROM golang:1.21-alpine AS builder +WORKDIR /app +COPY . /app +RUN go mod download && go mod verify +RUN cd /app && go build -o goapp +ENTRYPOINT ["./goapp"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..f89c51d63 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,17 @@ +services: + frontend-container: + image: frontenddocker + ports: + - 8080:8080 + depends_on: + - backend-container + environment: + BACKEND_PORT: 9000 + BACKEND_DNS: backend-container + + + backend-container: + image: backenddocker + ports: + - 9000:9000 + diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 000000000..0b7be642b --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,6 @@ +FROM golang:1.21-alpine AS builder +WORKDIR /app +COPY . /app +RUN go mod download && go mod verify +RUN cd /app && go build -o goapp +ENTRYPOINT ["./goapp"] \ No newline at end of file diff --git a/frontend/main.go b/frontend/main.go index bede472b4..27f4da2a4 100644 --- a/frontend/main.go +++ b/frontend/main.go @@ -101,5 +101,5 @@ func main() { http.Handle("/", http.FileServer(http.Dir("./static"))) err := http.ListenAndServe(":8080", nil) - fmt.Println("%v", err) + fmt.Printf("%v", err) }