From c8790f1a6e4ac1765a36b3c7e207927d2d4f2f13 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Sun, 21 May 2023 12:03:12 +0300 Subject: [PATCH 01/10] updated hotfixes --- .github/workflows/Untitled-1.yml | 14 -------------- .github/workflows/main2.yml | 2 +- .github/workflows/mockserver.yml | 25 ------------------------- 3 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 .github/workflows/Untitled-1.yml delete mode 100644 .github/workflows/mockserver.yml diff --git a/.github/workflows/Untitled-1.yml b/.github/workflows/Untitled-1.yml deleted file mode 100644 index 85920cf..0000000 --- a/.github/workflows/Untitled-1.yml +++ /dev/null @@ -1,14 +0,0 @@ -nginx: - image: nginx:latest - ports: - - 80:80 - volumes: - - ./nginx.conf:/etc/nginx/nginx.conf:ro - depends_on: - - app1 - - app2 - - app3 - - app1: - image: your_app_image1:latest - # Add other configurations for your app1 container \ No newline at end of file diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index 0d4c2ca..75a5734 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -32,7 +32,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | - docker build -t backend-everyshilling_app-auth:latest -f services/app-auth/Dev.Dockerfile . + docker build -t backend-everyshilling_app-auth:latest -f services/app-auth . docker build -t backend-everyshilling_app-db:latest -f services/app-db/Dev.Dockerfile . docker build -t backend-everyshilling_app-otp:latest -f services/app-otp/Dockerfile . docker tag backend-everyshilling_app-auth:latest ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-auth diff --git a/.github/workflows/mockserver.yml b/.github/workflows/mockserver.yml deleted file mode 100644 index 2392492..0000000 --- a/.github/workflows/mockserver.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: CI/CD Everyshilling - -on: - push: - branches: [ develop ] - -jobs: -#First we will see the application build or not , then we will deploy in EC2 - build: - runs-on: self-hosted - - steps: - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y make - sudo apt-get -y install docker-compose - - - name: Clone repository - uses: actions/checkout@v2 - - - name: Build and Deploy microservice - run: sudo make run-dev - - From fe5e9205a2e6f272913ddbc2b45c838f43f4e303 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Sun, 21 May 2023 12:30:28 +0300 Subject: [PATCH 02/10] app-auth dockerfile fix --- services/app-auth/Dev.Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/app-auth/Dev.Dockerfile b/services/app-auth/Dev.Dockerfile index c21f00e..406ced7 100644 --- a/services/app-auth/Dev.Dockerfile +++ b/services/app-auth/Dev.Dockerfile @@ -9,14 +9,13 @@ RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64; FROM golang-builder AS app-builder WORKDIR /app/auth -# Copy go mod files -COPY go.mod go.sum \ - /app/auth/ +# # Copy go mod files +# COPY go.mod go.sum \ +# /app/auth/ -RUN go mod download - -COPY . /app/auth +COPY . /app/auth/ +RUN go mod download RUN go build -o /tmp/app-auth @@ -33,4 +32,5 @@ FROM app-builder AS prepare-bin COPY --from=app-builder /tmp/app-auth /usr/bin/auth-service -ENTRYPOINT ["/usr/bin/auth-service"] \ No newline at end of file +ENTRYPOINT ["/usr/bin/auth-service"] + From 35720d90ccd48c6960ff754980f81464841d35a4 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Sun, 21 May 2023 12:36:06 +0300 Subject: [PATCH 03/10] app-auth dockerfile fix --- .github/workflows/main2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index 6ece7df..bc548bc 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -31,7 +31,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | - docker build -t backend-everyshilling_app-auth:latest -f services/app-auth . + docker build -t backend-everyshilling_app-auth:latest -f services/app-auth/Dev.Dockerfile . docker build -t backend-everyshilling_app-db:latest -f services/app-db/Dev.Dockerfile . docker build -t backend-everyshilling_app-otp:latest -f services/app-otp/Dockerfile . docker tag backend-everyshilling_app-auth:latest ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-auth From 7260674e166b4e2a41205384c81a6a97306c06e4 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Sun, 21 May 2023 12:38:53 +0300 Subject: [PATCH 04/10] app-auth dockerfile fix --- services/app-auth/Dev.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/app-auth/Dev.Dockerfile b/services/app-auth/Dev.Dockerfile index 406ced7..6cb0400 100644 --- a/services/app-auth/Dev.Dockerfile +++ b/services/app-auth/Dev.Dockerfile @@ -15,7 +15,7 @@ WORKDIR /app/auth COPY . /app/auth/ -RUN go mod download +# RUN go mod download RUN go build -o /tmp/app-auth From 3c707c8b91fa5f81889c7f405fa19bb9158fc705 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Sun, 21 May 2023 12:41:35 +0300 Subject: [PATCH 05/10] app-auth dockerfile fix --- services/app-auth/Dev.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/app-auth/Dev.Dockerfile b/services/app-auth/Dev.Dockerfile index 6cb0400..8961192 100644 --- a/services/app-auth/Dev.Dockerfile +++ b/services/app-auth/Dev.Dockerfile @@ -16,9 +16,9 @@ WORKDIR /app/auth COPY . /app/auth/ # RUN go mod download +# RUN go build -o /tmp/app-auth - -RUN go build -o /tmp/app-auth +RUN go mod init # Generate private and public keys RUN mkdir -p /etc/auth-service From 99e39162a82e19701f205db3c6d44e3a57353d48 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Sun, 21 May 2023 12:45:05 +0300 Subject: [PATCH 06/10] app-auth dockerfile fix --- services/app-auth/Dev.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/app-auth/Dev.Dockerfile b/services/app-auth/Dev.Dockerfile index 8961192..946c0d1 100644 --- a/services/app-auth/Dev.Dockerfile +++ b/services/app-auth/Dev.Dockerfile @@ -18,7 +18,7 @@ COPY . /app/auth/ # RUN go mod download # RUN go build -o /tmp/app-auth -RUN go mod init +# RUN go mod init # Generate private and public keys RUN mkdir -p /etc/auth-service From e06a62c9bf3fd2805825ca24b1ddb5cef1b61cc7 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Sun, 21 May 2023 12:48:02 +0300 Subject: [PATCH 07/10] app-auth dockerfile fix --- services/app-auth/Dev.Dockerfile | 53 ++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/services/app-auth/Dev.Dockerfile b/services/app-auth/Dev.Dockerfile index 946c0d1..71dedb7 100644 --- a/services/app-auth/Dev.Dockerfile +++ b/services/app-auth/Dev.Dockerfile @@ -1,3 +1,40 @@ +# # Initial stage: download modules +# FROM golang:1.18-alpine as golang-builder + +# RUN apk add build-base openssl +# RUN apk --update add git ca-certificates +# RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64; + + +# FROM golang-builder AS app-builder +# WORKDIR /app/auth + +# # # Copy go mod files +# # COPY go.mod go.sum \ +# # /app/auth/ + +# COPY . /app/auth/ + +# # RUN go mod download +# # RUN go build -o /tmp/app-auth + +# # RUN go mod init + +# # Generate private and public keys +# RUN mkdir -p /etc/auth-service + +# RUN if [ ! -e "/etc/auth-service/public.pem" ]; then \ +# openssl genrsa -out /etc/auth-service/private.pem 2048; \ +# openssl rsa -in /etc/auth-service/private.pem -pubout -out /etc/auth-service/public.pem; \ +# fi; + +# FROM app-builder AS prepare-bin + +# COPY --from=app-builder /tmp/app-auth /usr/bin/auth-service + +# ENTRYPOINT ["/usr/bin/auth-service"] + + # Initial stage: download modules FROM golang:1.18-alpine as golang-builder @@ -5,20 +42,17 @@ RUN apk add build-base openssl RUN apk --update add git ca-certificates RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64; - -FROM golang-builder AS app-builder +ENV GO111MODULE=on WORKDIR /app/auth -# # Copy go mod files -# COPY go.mod go.sum \ -# /app/auth/ +# Copy go mod files +COPY go.mod go.sum ./ -COPY . /app/auth/ +RUN go mod download -# RUN go mod download -# RUN go build -o /tmp/app-auth +COPY . ./ -# RUN go mod init +RUN go build -o /tmp/app-auth # Generate private and public keys RUN mkdir -p /etc/auth-service @@ -33,4 +67,3 @@ FROM app-builder AS prepare-bin COPY --from=app-builder /tmp/app-auth /usr/bin/auth-service ENTRYPOINT ["/usr/bin/auth-service"] - From 3bf05eac3ffb8aadd0e4309ec850c4de1d7179ed Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Mon, 22 May 2023 11:54:16 +0300 Subject: [PATCH 08/10] final updated file --- .github/workflows/main2.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index bc548bc..b636291 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -41,24 +41,6 @@ jobs: docker push ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-db docker push ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-otp - # run: | - # make build-dev - - # APP_AUTH_TAG=$(docker images --filter=reference='everyshilling_app-auth:latest' --format "{{.ID}}") - # APP_DB_TAG=$(docker images --filter=reference='everyshilling_app-db:latest' --format "{{.ID}}") - # APP_OTP_TAG=$(docker images --filter=reference='everyshilling_app-otp:latest' --format "{{.ID}}") - - # # Tag and push the Docker images - # docker tag everyshilling_app-auth:latest ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-auth - # docker tag everyshilling_app-db:latest ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-db - # docker tag everyshilling_app-otp:latest ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-otp - # docker push ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-auth - # docker push ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-db - # docker push ${{ secrets.ECR_ACCOUNT }}/$ECR_REPOSITORY:app-otp - - - - # # everyshilling is the stack name From 3ed2e484fef8b2311193cca57fe556af950eabe8 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Mon, 22 May 2023 12:34:03 +0300 Subject: [PATCH 09/10] Update main2.yml --- .github/workflows/main2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index b636291..664c5a0 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -30,7 +30,7 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | - + docker login https://github.com/AppsLab-KE/backend-everyshilling.git docker build -t backend-everyshilling_app-auth:latest -f services/app-auth/Dev.Dockerfile . docker build -t backend-everyshilling_app-db:latest -f services/app-db/Dev.Dockerfile . docker build -t backend-everyshilling_app-otp:latest -f services/app-otp/Dockerfile . From 3993ced743cd192ad48853f28329d6a5852c3813 Mon Sep 17 00:00:00 2001 From: ElsieMarion Date: Tue, 23 May 2023 11:59:31 +0300 Subject: [PATCH 10/10] Update main2.yml --- .github/workflows/main2.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index 00d59d0..11aa0f4 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -30,7 +30,6 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | - docker login https://github.com/AppsLab-KE/backend-everyshilling.git docker build -t backend-everyshilling_app-auth:latest -f services/app-auth/Dev.Dockerfile services/app-auth docker build -t backend-everyshilling_app-db:latest -f services/app-db/Dev.Dockerfile services/app-db docker build -t backend-everyshilling_app-otp:latest -f services/app-otp/Dockerfile services/app-otp