From 2a6b2faee5f62733b7f4fbd4a9f27df48ce17303 Mon Sep 17 00:00:00 2001 From: delyc Date: Wed, 18 Sep 2024 15:33:18 +0200 Subject: [PATCH 01/11] feat: built frontend and backend production docker image --- docs/development/build-for-production.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/development/build-for-production.md b/docs/development/build-for-production.md index 1d7aeb7ed..bec113a73 100644 --- a/docs/development/build-for-production.md +++ b/docs/development/build-for-production.md @@ -2,22 +2,23 @@ order: 6 --- + # Building docker image for production -## Backend Prod +### Backend Prod From the root directory run -```bash +``` docker build --platform linux/amd64 -t micropowermanager-laravel-prod -f Docker/DockerfileLaravelProd . ``` -## Frontend Prod -```bash -cd Website/ui -``` +### Frontend Prod + -```bash -docker build --platform linux/amd64 -t micropowermanager-frontend-prod -f Dockerfile ``` +docker build --platform linux/amd64 -t micropowermanager-ui-prod -f Docker/DockerfileUIProd . +``` + + From f18d14874b48ca36b524394fdd857c78594126ca Mon Sep 17 00:00:00 2001 From: delyc Date: Wed, 18 Sep 2024 15:38:31 +0200 Subject: [PATCH 02/11] fix: fix markdown linting --- docs/development/build-for-production.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/development/build-for-production.md b/docs/development/build-for-production.md index bec113a73..2643eac9b 100644 --- a/docs/development/build-for-production.md +++ b/docs/development/build-for-production.md @@ -2,17 +2,17 @@ order: 6 --- - # Building docker image for production -### Backend Prod +## Backend Prod From the root directory run -``` +```bash docker build --platform linux/amd64 -t micropowermanager-laravel-prod -f Docker/DockerfileLaravelProd . ``` +## Frontend Prod ### Frontend Prod @@ -20,5 +20,3 @@ docker build --platform linux/amd64 -t micropowermanager-laravel-prod -f Docker/ ``` docker build --platform linux/amd64 -t micropowermanager-ui-prod -f Docker/DockerfileUIProd . ``` - - From d80c0031e8d10f2414942bffca03465014e4ac35 Mon Sep 17 00:00:00 2001 From: delyc Date: Thu, 19 Sep 2024 10:18:51 +0200 Subject: [PATCH 03/11] feat: moving frontend docker file to docker folder --- Docker/DockerfileUIProd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Docker/DockerfileUIProd diff --git a/Docker/DockerfileUIProd b/Docker/DockerfileUIProd new file mode 100644 index 000000000..b1855fe17 --- /dev/null +++ b/Docker/DockerfileUIProd @@ -0,0 +1,26 @@ +FROM node:18.20.4 + +# Install simple http server for serving static content +RUN npm install -g http-server + +# Make the 'app' folder the current working directory +WORKDIR /app + +# Copy 'package.json' and 'package-lock.json' +COPY ../Website/ui/package*.json ./ + +# Install project dependencies +RUN npm install + +# Force the upgrade of restore-cursor and onetime to the latest versions +RUN npm install restore-cursor@latest onetime@latest + +# Copy project files and folders to the current working directory (i.e. 'app' folder) +COPY ../Website/ui . + +# Build app for production with minification +RUN npm run build + +EXPOSE 8081 + +CMD [ "http-server", "dist", "-p", "8081" ] From f862434b1672aba521f3e031a3a242799f3b527b Mon Sep 17 00:00:00 2001 From: delyc Date: Thu, 19 Sep 2024 10:32:31 +0200 Subject: [PATCH 04/11] removing duplicated titles --- docs/development/build-for-production.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/development/build-for-production.md b/docs/development/build-for-production.md index 2643eac9b..1c831547d 100644 --- a/docs/development/build-for-production.md +++ b/docs/development/build-for-production.md @@ -14,8 +14,6 @@ docker build --platform linux/amd64 -t micropowermanager-laravel-prod -f Docker/ ## Frontend Prod -### Frontend Prod - ``` docker build --platform linux/amd64 -t micropowermanager-ui-prod -f Docker/DockerfileUIProd . From 50019a4342563b874c2a3803e25fcd8ccac3c980 Mon Sep 17 00:00:00 2001 From: delyc Date: Thu, 19 Sep 2024 10:35:55 +0200 Subject: [PATCH 05/11] adding bash --- docs/development/build-for-production.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/development/build-for-production.md b/docs/development/build-for-production.md index 1c831547d..e86032fd4 100644 --- a/docs/development/build-for-production.md +++ b/docs/development/build-for-production.md @@ -14,7 +14,6 @@ docker build --platform linux/amd64 -t micropowermanager-laravel-prod -f Docker/ ## Frontend Prod - -``` +```bash docker build --platform linux/amd64 -t micropowermanager-ui-prod -f Docker/DockerfileUIProd . ``` From 78bb8605c4123d9a9cacffade5b373bc9958f885 Mon Sep 17 00:00:00 2001 From: delyc Date: Thu, 19 Sep 2024 10:50:42 +0200 Subject: [PATCH 06/11] deleted ui prod docker file under ui folder --- Website/ui/Dockerfile | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 Website/ui/Dockerfile diff --git a/Website/ui/Dockerfile b/Website/ui/Dockerfile deleted file mode 100644 index 352661714..000000000 --- a/Website/ui/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM node:18.20.4 - -# install simple http server for serving static content -RUN npm install -g http-server - -# make the 'app' folder the current working directory -WORKDIR /app - -# copy both 'package.json' and 'package-lock.json' (if available) -COPY package*.json ./ - -# install project dependencies -RUN npm install - -# copy project files and folders to the current working directory (i.e. 'app' folder) -COPY . . - -# build app for production with minification -RUN npm run build - -EXPOSE 8081 - -CMD [ "http-server", "dist", "-p", "8081" ] \ No newline at end of file From 7c940d7d3167368784f186c723ba149f2d11357c Mon Sep 17 00:00:00 2001 From: delyc Date: Tue, 24 Sep 2024 09:44:21 +0200 Subject: [PATCH 07/11] feat: mocing frontend dev dockerfile --- .github/workflows/deploy-be-dockerimage.yaml | 32 +++++++++++++++++++ .github/workflows/deploy-fe-dockerimage.yaml | 32 +++++++++++++++++++ .../DockerfileServe => Docker/DockerfileUIDev | 6 ++-- 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy-be-dockerimage.yaml create mode 100644 .github/workflows/deploy-fe-dockerimage.yaml rename Website/ui/DockerfileServe => Docker/DockerfileUIDev (57%) diff --git a/.github/workflows/deploy-be-dockerimage.yaml b/.github/workflows/deploy-be-dockerimage.yaml new file mode 100644 index 000000000..84aae309c --- /dev/null +++ b/.github/workflows/deploy-be-dockerimage.yaml @@ -0,0 +1,32 @@ +name: Build and Push MPM Backend Image + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./Website/htdocs/mpmanager + file: ./Website/htdocs/mpmanager/Dockerfile + platforms: linux/amd64 + push: true + tags: enaccess/mpm-backend:latest \ No newline at end of file diff --git a/.github/workflows/deploy-fe-dockerimage.yaml b/.github/workflows/deploy-fe-dockerimage.yaml new file mode 100644 index 000000000..fcbf73a86 --- /dev/null +++ b/.github/workflows/deploy-fe-dockerimage.yaml @@ -0,0 +1,32 @@ +name: Build and Push MPM Frontend Image + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./Website/ui + file: ./Website/ui/Dockerfile + platforms: linux/amd64 + push: true + tags: enaccess/mpm-frontend:latest \ No newline at end of file diff --git a/Website/ui/DockerfileServe b/Docker/DockerfileUIDev similarity index 57% rename from Website/ui/DockerfileServe rename to Docker/DockerfileUIDev index 5c56c706e..e1661f581 100644 --- a/Website/ui/DockerfileServe +++ b/Docker/DockerfileUIDev @@ -3,11 +3,11 @@ FROM node:18.20.4 WORKDIR /usr/app # Copy the package.json and install dependencies -COPY package*.json ./ +COPY ../Website/ui/package*.json ./ RUN npm install -# Copy rest of the files -COPY --chown=www-data:www-data . . +# Copy the rest of the files +COPY --chown=www-data:www-data ../Website/ui . EXPOSE 8080 From ce8b855e5296a56b2c54b62d1ee275edf3d3af0e Mon Sep 17 00:00:00 2001 From: delyc Date: Tue, 24 Sep 2024 10:13:14 +0200 Subject: [PATCH 08/11] fix: fixing workflow identation --- .github/workflows/deploy-be-dockerimage.yaml | 36 ++++++++++---------- .github/workflows/deploy-fe-dockerimage.yaml | 36 ++++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/deploy-be-dockerimage.yaml b/.github/workflows/deploy-be-dockerimage.yaml index 84aae309c..c1eb715c7 100644 --- a/.github/workflows/deploy-be-dockerimage.yaml +++ b/.github/workflows/deploy-be-dockerimage.yaml @@ -3,30 +3,30 @@ name: Build and Push MPM Backend Image on: push: branches: - - main + - deploy/docker-images jobs: build-and-push: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: ./Website/htdocs/mpmanager - file: ./Website/htdocs/mpmanager/Dockerfile - platforms: linux/amd64 - push: true - tags: enaccess/mpm-backend:latest \ No newline at end of file + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./Website/htdocs/mpmanager + file: ./Website/htdocs/mpmanager/Dockerfile + platforms: linux/amd64 + push: true + tags: enaccess/mpm-backend:latest diff --git a/.github/workflows/deploy-fe-dockerimage.yaml b/.github/workflows/deploy-fe-dockerimage.yaml index fcbf73a86..9009c4bb6 100644 --- a/.github/workflows/deploy-fe-dockerimage.yaml +++ b/.github/workflows/deploy-fe-dockerimage.yaml @@ -3,30 +3,30 @@ name: Build and Push MPM Frontend Image on: push: branches: - - main + - deploy/docker-images jobs: build-and-push: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: ./Website/ui - file: ./Website/ui/Dockerfile - platforms: linux/amd64 - push: true - tags: enaccess/mpm-frontend:latest \ No newline at end of file + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./Website/ui + file: ./Website/ui/Dockerfile + platforms: linux/amd64 + push: true + tags: enaccess/mpm-frontend:latest From 4834b0b8dd91efd7caaa65bb67e62628e0414abd Mon Sep 17 00:00:00 2001 From: delyc Date: Tue, 24 Sep 2024 10:18:21 +0200 Subject: [PATCH 09/11] feat: Updating docker path in workflow --- .github/workflows/deploy-be-dockerimage.yaml | 4 ++-- .github/workflows/deploy-fe-dockerimage.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-be-dockerimage.yaml b/.github/workflows/deploy-be-dockerimage.yaml index c1eb715c7..821760daa 100644 --- a/.github/workflows/deploy-be-dockerimage.yaml +++ b/.github/workflows/deploy-be-dockerimage.yaml @@ -25,8 +25,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./Website/htdocs/mpmanager - file: ./Website/htdocs/mpmanager/Dockerfile + context: ./Docker + file: ./Docker/DockerfileLaravelProd platforms: linux/amd64 push: true tags: enaccess/mpm-backend:latest diff --git a/.github/workflows/deploy-fe-dockerimage.yaml b/.github/workflows/deploy-fe-dockerimage.yaml index 9009c4bb6..4b2b453ff 100644 --- a/.github/workflows/deploy-fe-dockerimage.yaml +++ b/.github/workflows/deploy-fe-dockerimage.yaml @@ -25,8 +25,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./Website/ui - file: ./Website/ui/Dockerfile + context: ./Docker + file: ./Docker/DockerfileUIProd platforms: linux/amd64 push: true tags: enaccess/mpm-frontend:latest From db5b4cc25800eae5dc64731d76c5bac1ff942c29 Mon Sep 17 00:00:00 2001 From: delyc Date: Tue, 24 Sep 2024 10:22:00 +0200 Subject: [PATCH 10/11] fix: yamlint --- .github/workflows/deploy-be-dockerimage.yaml | 2 +- .github/workflows/deploy-fe-dockerimage.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-be-dockerimage.yaml b/.github/workflows/deploy-be-dockerimage.yaml index 821760daa..a2bd9a6a7 100644 --- a/.github/workflows/deploy-be-dockerimage.yaml +++ b/.github/workflows/deploy-be-dockerimage.yaml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/deploy-fe-dockerimage.yaml b/.github/workflows/deploy-fe-dockerimage.yaml index 4b2b453ff..8bfc4b002 100644 --- a/.github/workflows/deploy-fe-dockerimage.yaml +++ b/.github/workflows/deploy-fe-dockerimage.yaml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 112f72a44570b19587d546c546b6eb0d51cdf3f9 Mon Sep 17 00:00:00 2001 From: delyc Date: Tue, 24 Sep 2024 10:23:59 +0200 Subject: [PATCH 11/11] fix: changing path --- .github/workflows/deploy-be-dockerimage.yaml | 1 - .github/workflows/deploy-fe-dockerimage.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/deploy-be-dockerimage.yaml b/.github/workflows/deploy-be-dockerimage.yaml index a2bd9a6a7..e3d1a588f 100644 --- a/.github/workflows/deploy-be-dockerimage.yaml +++ b/.github/workflows/deploy-be-dockerimage.yaml @@ -25,7 +25,6 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./Docker file: ./Docker/DockerfileLaravelProd platforms: linux/amd64 push: true diff --git a/.github/workflows/deploy-fe-dockerimage.yaml b/.github/workflows/deploy-fe-dockerimage.yaml index 8bfc4b002..18c20521a 100644 --- a/.github/workflows/deploy-fe-dockerimage.yaml +++ b/.github/workflows/deploy-fe-dockerimage.yaml @@ -25,7 +25,6 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./Docker file: ./Docker/DockerfileUIProd platforms: linux/amd64 push: true