From 4ef5130e7887c0c97ff6a2ad154e10c30a334bfa Mon Sep 17 00:00:00 2001 From: Olsgaard1 <143800465+Olsgaard1@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:19:32 +0200 Subject: [PATCH 01/30] Create main.yml (#2) * Create main.yml * Update main.yml * Update main.yml * Update main.yml Test and build added * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.go --------- Co-authored-by: albla20 <143800277+albla20@users.noreply.github.com> --- .github/workflows/main.yml | 30 ++++++++++++++++++++++++++++++ frontend/main.go | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..c68e5b6ba --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +name: main workflow +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + Build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.21.12' + - name: Build backend + run: | + cd backend + go build . + - name: Build frontend + run: | + cd frontend + go build . + - name: test frontend + run: | + cd frontend + go test ./... + 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) } From c7056bb2e757e9191d448572692f413b1c0d269c Mon Sep 17 00:00:00 2001 From: maove23 Date: Thu, 14 Aug 2025 10:03:39 +0000 Subject: [PATCH 02/30] Inserted dockerfiles for backend and frontend --- frontend/Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 frontend/Dockerfile diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 000000000..bbbb669ed --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,12 @@ +# Build stage +FROM golang:1.21 as builder +WORKDIR /app +COPY . . +RUN go mod download +RUN go build -o frontend . + +# Run stage +FROM gcr.io/distroless/base-debian12 +COPY --from=builder /app/frontend /frontend +EXPOSE 8080 +CMD ["/frontend"] From b7c2a3b6f0a087c472abadab7588a104f97da8d6 Mon Sep 17 00:00:00 2001 From: maove23 Date: Thu, 14 Aug 2025 10:08:07 +0000 Subject: [PATCH 03/30] dockerfiles added --- backend/Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 backend/Dockerfile diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 000000000..f456f03d5 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,12 @@ +# Build stage +FROM golang:1.21 as builder +WORKDIR /app +COPY . . +RUN go mod download +RUN go build -o backend . + +# Run stage +FROM gcr.io/distroless/base-debian12 +COPY --from=builder /app/backend /backend +EXPOSE 9000 +CMD ["/backend"] From 6557da1cc3f482b967c37666ffa2f5d9270f14f7 Mon Sep 17 00:00:00 2001 From: Olsgaard1 <143800465+Olsgaard1@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:37:41 +0200 Subject: [PATCH 04/30] added Manifests waiting for images (#7) --- Manifests/backend-pod.yaml | 10 ++++++++++ Manifests/frontend-pod.yaml | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Manifests/backend-pod.yaml create mode 100644 Manifests/frontend-pod.yaml diff --git a/Manifests/backend-pod.yaml b/Manifests/backend-pod.yaml new file mode 100644 index 000000000..60fabc470 --- /dev/null +++ b/Manifests/backend-pod.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Pod +metadata: + name: backend +spec: + containers: + - name: backend + image: + ports: + - containerPort: 9000 diff --git a/Manifests/frontend-pod.yaml b/Manifests/frontend-pod.yaml new file mode 100644 index 000000000..5c5eb3b7b --- /dev/null +++ b/Manifests/frontend-pod.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Pod +metadata: + name: frontend +spec: + containers: + - name: frontend + image: + ports: + - containerPort: 8080 From ce8981368149d6528c71113fb535ffbf7cb0a20f Mon Sep 17 00:00:00 2001 From: maove23 Date: Thu, 14 Aug 2025 10:44:55 +0000 Subject: [PATCH 05/30] dockerfile update --- frontend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index bbbb669ed..64a059b2b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -6,7 +6,7 @@ RUN go mod download RUN go build -o frontend . # Run stage -FROM gcr.io/distroless/base-debian12 +FROM alpine:3.19 COPY --from=builder /app/frontend /frontend EXPOSE 8080 CMD ["/frontend"] From ed02ddb812d2308dabb13e9fd4f515421779b890 Mon Sep 17 00:00:00 2001 From: albla20 <143800277+albla20@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:57:52 +0200 Subject: [PATCH 06/30] Create docker.yml --- .github/workflows/docker.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..5b7ac463a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,22 @@ +name: Build and Push Docker Image + +on: + push: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + - name: Build and push + run: | + IMAGE=mathiasoverby/backend:latest + IMAGE=mathiasoverby/frontend:latest + docker build -t $IMAGE . + docker push $IMAGE From 8076d4125dda8b4bd40c99fd16a89259a5bf4e1a Mon Sep 17 00:00:00 2001 From: maove23 Date: Thu, 14 Aug 2025 12:12:29 +0000 Subject: [PATCH 07/30] updated docker files and spinned up pods --- Manifests/backend-pod.yaml | 2 +- Manifests/frontend-pod.yaml | 2 +- backend/Dockerfile | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Manifests/backend-pod.yaml b/Manifests/backend-pod.yaml index 60fabc470..e8fc93925 100644 --- a/Manifests/backend-pod.yaml +++ b/Manifests/backend-pod.yaml @@ -5,6 +5,6 @@ metadata: spec: containers: - name: backend - image: + image: mathiasoverby/backend:latest ports: - containerPort: 9000 diff --git a/Manifests/frontend-pod.yaml b/Manifests/frontend-pod.yaml index 5c5eb3b7b..f4453a6fd 100644 --- a/Manifests/frontend-pod.yaml +++ b/Manifests/frontend-pod.yaml @@ -5,6 +5,6 @@ metadata: spec: containers: - name: frontend - image: + image: mathiasoverby/frontend:latest ports: - containerPort: 8080 diff --git a/backend/Dockerfile b/backend/Dockerfile index f456f03d5..f6b4bce4c 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,12 +1,14 @@ # Build stage -FROM golang:1.21 as builder +FROM golang:1.21 +# as builder WORKDIR /app COPY . . RUN go mod download RUN go build -o backend . +EXPOSE 9000 +CMD ["./backend"] # Run stage -FROM gcr.io/distroless/base-debian12 -COPY --from=builder /app/backend /backend -EXPOSE 9000 -CMD ["/backend"] +#FROM alpine:3.19 +#COPY --from=builder /app/backend backend +#CMD ["backend"] From faa8b41986c2c41abb1e7194b6118d4e21143f40 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:27:13 +0200 Subject: [PATCH 08/30] Update main.yml --- .github/workflows/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c68e5b6ba..4235514ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,10 @@ on: pull_request: branches: - main +env: + docker_username: ${{ github.actor }} + docker_password: ${{ secrets.GITHUB_TOKEN }} + GIT_COMMIT: ${{ github.sha }} jobs: Build: runs-on: ubuntu-latest @@ -27,4 +31,15 @@ jobs: run: | cd frontend go test ./... + - name: Checkout + uses: actions/checkout@v3 + + + - name: Build and push + run: | + IMAGE=mathiasoverby/backend:latest + IMAGE=mathiasoverby/frontend:latest + docker build -t $IMAGE . + docker push $IMAGE + From 2cf0670ebbb6d66b6f3ac605ff0c0d817b7e029b Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:33:23 +0200 Subject: [PATCH 09/30] Update main.yml --- .github/workflows/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4235514ff..a6d4a2908 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,5 +41,12 @@ jobs: IMAGE=mathiasoverby/frontend:latest docker build -t $IMAGE . docker push $IMAGE - - + - name: Log in to Docker Hub + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + - name: Build and push + run: | + IMAGE=mathiasoverby/backend:latest + IMAGE=mathiasoverby/frontend:latest + docker build -t $IMAGE . + docker push $IMAGE From ea30e9e1b9365aae81dc1a188b1cd2b8ec1ec279 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:43:52 +0200 Subject: [PATCH 10/30] Update main.yml --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6d4a2908..41e108462 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,9 @@ jobs: run: | IMAGE=mathiasoverby/backend:latest IMAGE=mathiasoverby/frontend:latest - docker build -t $IMAGE . + docker build -t mathiasoverby/frontend:latest . + docker build -t mathiasoverby/backend:latest . + docker push $IMAGE - name: Log in to Docker Hub run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin From f37f949fbb0d776f8aee66d936c2958cc072f503 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:46:03 +0200 Subject: [PATCH 11/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 41e108462..fa6473629 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,8 +37,8 @@ jobs: - name: Build and push run: | - IMAGE=mathiasoverby/backend:latest - IMAGE=mathiasoverby/frontend:latest + IMAGE=backend/Dockerfile + IMAGE=frontend/Dockerfile docker build -t mathiasoverby/frontend:latest . docker build -t mathiasoverby/backend:latest . From 9680c4eb9c430fd492777dd7bd94df12e7428f2b Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:54:22 +0200 Subject: [PATCH 12/30] Update main.yml --- .github/workflows/main.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fa6473629..6c937e0b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,20 +35,19 @@ jobs: uses: actions/checkout@v3 - - name: Build and push - run: | - IMAGE=backend/Dockerfile - IMAGE=frontend/Dockerfile - docker build -t mathiasoverby/frontend:latest . - docker build -t mathiasoverby/backend:latest . - - docker push $IMAGE - name: Log in to Docker Hub - run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push + - name: Build and push Docker images + run: | + docker build -t mathiasoverby/backend:latest ./backend + docker push mathiasoverby/backend:latest + docker build -t mathiasoverby/frontend:latest ./frontend + docker push mathiasoverby/frontend:latest + - name: pull docker images run: | - IMAGE=mathiasoverby/backend:latest - IMAGE=mathiasoverby/frontend:latest - docker build -t $IMAGE . - docker push $IMAGE + docker pull mathiasoverby/backend:latest + docker pull mathiasoverby/frontend:latest From c07ec99486d065f9277a97a9399b5b11de86b34a Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:56:15 +0200 Subject: [PATCH 13/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c937e0b8..51b66d4ce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,8 +38,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ env.DOCKER_USERNAME }} + password: ${{ env.DOCKER_PASSWORD }} - name: Build and push Docker images run: | From 22f4dd5fd2f55b313466fa1ad1a1e268f1e74981 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:57:30 +0200 Subject: [PATCH 14/30] Update main.yml --- .github/workflows/main.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 51b66d4ce..9da893f07 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,13 +34,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ env.DOCKER_USERNAME }} - password: ${{ env.DOCKER_PASSWORD }} - - name: Build and push Docker images run: | docker build -t mathiasoverby/backend:latest ./backend From 6e54a45907a526dd0ddd4d005ad1abcb7dd794e9 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:10:44 +0200 Subject: [PATCH 15/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9da893f07..e81f1784f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,9 +36,9 @@ jobs: - name: Build and push Docker images run: | - docker build -t mathiasoverby/backend:latest ./backend + docker build -t mathiasoverby/backend:latest . docker push mathiasoverby/backend:latest - docker build -t mathiasoverby/frontend:latest ./frontend + docker build -t mathiasoverby/frontend:latest . docker push mathiasoverby/frontend:latest - name: pull docker images run: | From da63a5662c771112ee249d55d2708a0284664428 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:13:19 +0200 Subject: [PATCH 16/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e81f1784f..662fefc66 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,9 +36,9 @@ jobs: - name: Build and push Docker images run: | - docker build -t mathiasoverby/backend:latest . + docker build -t mathiasoverby/backend:latest docker push mathiasoverby/backend:latest - docker build -t mathiasoverby/frontend:latest . + docker build -t mathiasoverby/frontend:latest docker push mathiasoverby/frontend:latest - name: pull docker images run: | From 297b4245fdf78e74052bccedeee7824e598c570d Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:15:51 +0200 Subject: [PATCH 17/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 662fefc66..9da893f07 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,9 +36,9 @@ jobs: - name: Build and push Docker images run: | - docker build -t mathiasoverby/backend:latest + docker build -t mathiasoverby/backend:latest ./backend docker push mathiasoverby/backend:latest - docker build -t mathiasoverby/frontend:latest + docker build -t mathiasoverby/frontend:latest ./frontend docker push mathiasoverby/frontend:latest - name: pull docker images run: | From af439815cbb99d1a5366bbe0530609a35336f8b1 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:17:51 +0200 Subject: [PATCH 18/30] Update Dockerfile --- backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index f6b4bce4c..76f53d3d0 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -6,7 +6,7 @@ COPY . . RUN go mod download RUN go build -o backend . EXPOSE 9000 -CMD ["./backend"] +CMD ["./backend", "run", "go"] # Run stage #FROM alpine:3.19 From eb34902dc297051522bcb745dd235f24aa73827e Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:18:14 +0200 Subject: [PATCH 19/30] Update Dockerfile --- frontend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 64a059b2b..a32746893 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -9,4 +9,4 @@ RUN go build -o frontend . FROM alpine:3.19 COPY --from=builder /app/frontend /frontend EXPOSE 8080 -CMD ["/frontend"] +CMD ["/frontend", "run", "go"] From 5c91664b58b94204523a07d8b5faaf3a2118a2e7 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:24:17 +0200 Subject: [PATCH 20/30] Update main.yml --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9da893f07..9c4a6ae56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,7 +33,11 @@ jobs: go test ./... - name: Checkout uses: actions/checkout@v3 - + - name: login to docker hub + uses: docker/login-action@v3 + with: + username: ${{env.docker_username}} + password: ${{ env.docker_password }} - name: Build and push Docker images run: | docker build -t mathiasoverby/backend:latest ./backend From 5037738aeee5986c5e5d1bbcf7a934bed0ae02d3 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:26:25 +0200 Subject: [PATCH 21/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9c4a6ae56..87bc6a1d9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,8 +36,8 @@ jobs: - name: login to docker hub uses: docker/login-action@v3 with: - username: ${{env.docker_username}} - password: ${{ env.docker_password }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push Docker images run: | docker build -t mathiasoverby/backend:latest ./backend From 2926929e53bcb587013880e9b827c724f0df3d0d Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:28:03 +0200 Subject: [PATCH 22/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 87bc6a1d9..6161b6722 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,8 +36,8 @@ jobs: - name: login to docker hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ env.DOCKER_USERNAME }} + password: ${{ env.DOCKER_PASSWORD }} - name: Build and push Docker images run: | docker build -t mathiasoverby/backend:latest ./backend From 25737a25a1a9518bd85d2f0195b06c0ef7fe2c23 Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:38:13 +0200 Subject: [PATCH 23/30] Update main.yml --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6161b6722..9eb418e14 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,11 +40,11 @@ jobs: password: ${{ env.DOCKER_PASSWORD }} - name: Build and push Docker images run: | - docker build -t mathiasoverby/backend:latest ./backend - docker push mathiasoverby/backend:latest - docker build -t mathiasoverby/frontend:latest ./frontend - docker push mathiasoverby/frontend:latest + docker build -t albla20/backend:latest ./backend + docker push albla20/backend:latest + docker build -t albla20/frontend:latest ./frontend + docker push albla20/frontend:latest - name: pull docker images run: | - docker pull mathiasoverby/backend:latest - docker pull mathiasoverby/frontend:latest + docker pull albla20/backend:latest + docker pull albla20/frontend:latest From 95ee2c76c890d6e3295f1cc5c411a59f5693187c Mon Sep 17 00:00:00 2001 From: mathiasoverby <143800439+mathiasoverby@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:39:59 +0200 Subject: [PATCH 24/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9eb418e14..7cfac8361 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,8 +36,8 @@ jobs: - name: login to docker hub uses: docker/login-action@v3 with: - username: ${{ env.DOCKER_USERNAME }} - password: ${{ env.DOCKER_PASSWORD }} + username: ${{ env.docker_username }} + password: ${{ env.docker_password}} - name: Build and push Docker images run: | docker build -t albla20/backend:latest ./backend From 1056de634e7e981d42fc1bcc4ba46780b0d50a01 Mon Sep 17 00:00:00 2001 From: albla20 <143800277+albla20@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:49:01 +0200 Subject: [PATCH 25/30] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7cfac8361..ba2bd2fde 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,9 +40,9 @@ jobs: password: ${{ env.docker_password}} - name: Build and push Docker images run: | - docker build -t albla20/backend:latest ./backend + docker build -t albla20/backend:latest docker push albla20/backend:latest - docker build -t albla20/frontend:latest ./frontend + docker build -t albla20/frontend:latest docker push albla20/frontend:latest - name: pull docker images run: | From a372fb41a876d28a89d032328409135c856b9ff7 Mon Sep 17 00:00:00 2001 From: albla20 <143800277+albla20@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:56:38 +0200 Subject: [PATCH 26/30] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba2bd2fde..1c183b1b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ on: env: docker_username: ${{ github.actor }} docker_password: ${{ secrets.GITHUB_TOKEN }} - GIT_COMMIT: ${{ github.sha }} + GIT_COMMIT: ${{ github.sha }} jobs: Build: runs-on: ubuntu-latest From b057df093de09fe44777b7084fdf416b84610f49 Mon Sep 17 00:00:00 2001 From: albla20 <143800277+albla20@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:58:28 +0200 Subject: [PATCH 27/30] Update main.yml Changed the Tokens --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c183b1b9..28060733a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,8 +36,8 @@ jobs: - name: login to docker hub uses: docker/login-action@v3 with: - username: ${{ env.docker_username }} - password: ${{ env.docker_password}} + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} - name: Build and push Docker images run: | docker build -t albla20/backend:latest From b5b4ca202e8bd5f89fdc851034f8fbfcb56b4c1f Mon Sep 17 00:00:00 2001 From: albla20 <143800277+albla20@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:00:58 +0200 Subject: [PATCH 28/30] Update main.yml Changed the env --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 28060733a..bb242fc78 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,9 +6,7 @@ on: pull_request: branches: - main -env: - docker_username: ${{ github.actor }} - docker_password: ${{ secrets.GITHUB_TOKEN }} +env: GIT_COMMIT: ${{ github.sha }} jobs: Build: From 63755b73e293d6c71527a98048149a6d2ef5f4b5 Mon Sep 17 00:00:00 2001 From: albla20 <143800277+albla20@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:14:29 +0200 Subject: [PATCH 29/30] Update main.yml Changed The push and pull to github reg instead of docker. --- .github/workflows/main.yml | 53 ++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb242fc78..53d84c7a6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,48 +1,61 @@ name: main workflow + on: push: branches: - - main + - main pull_request: branches: - - main -env: - GIT_COMMIT: ${{ github.sha }} + - main + +env: + GIT_COMMIT: ${{ github.sha }} + jobs: - Build: - runs-on: ubuntu-latest - steps: + Build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: - uses: actions/checkout@v4 + - name: Setup Go uses: actions/setup-go@v5 with: go-version: '1.21.12' + - name: Build backend run: | cd backend go build . + - name: Build frontend run: | cd frontend go build . - - name: test frontend + + - name: Test frontend run: | cd frontend go test ./... - - name: Checkout - uses: actions/checkout@v3 - - name: login to docker hub + + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push Docker images run: | - docker build -t albla20/backend:latest - docker push albla20/backend:latest - docker build -t albla20/frontend:latest - docker push albla20/frontend:latest - - name: pull docker images + docker build -t ghcr.io/albla20/backend:latest backend + docker push ghcr.io/albla20/backend:latest + + docker build -t ghcr.io/albla20/frontend:latest frontend + docker push ghcr.io/albla20/frontend:latest + + - name: Pull docker images run: | - docker pull albla20/backend:latest - docker pull albla20/frontend:latest + docker pull ghcr.io/albla20/backend:latest + docker pull ghcr.io/albla20/frontend:latest From b7e04300bb885235986e6e38c24b88b05ceb7d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Bl=C3=A5sten?= Date: Thu, 14 Aug 2025 14:32:39 +0000 Subject: [PATCH 30/30] Added docker-compose file --- docker-compose.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..5624d10bc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.9" +services: + backend: + build: + context: ./backend + dockerfile: Dockerfile + image: albla20/backend:latest + ports: + - 9000 + frontend: + build: + context: ./frontend + dockerfile: Dockerfile + image: albla20/frontend:latest + ports: + - 8080 + depends_on: + - backend \ No newline at end of file