Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy/docker images #278

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/deploy-be-dockerimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Push MPM Backend Image

on:
push:
branches:
- deploy/docker-images

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:
file: ./Docker/DockerfileLaravelProd
platforms: linux/amd64
push: true
tags: enaccess/mpm-backend:latest
31 changes: 31 additions & 0 deletions .github/workflows/deploy-fe-dockerimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Push MPM Frontend Image

on:
push:
branches:
- deploy/docker-images

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:
file: ./Docker/DockerfileUIProd
platforms: linux/amd64
push: true
tags: enaccess/mpm-frontend:latest
6 changes: 3 additions & 3 deletions Website/ui/DockerfileServe → Docker/DockerfileUIDev
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 26 additions & 0 deletions Docker/DockerfileUIProd
Original file line number Diff line number Diff line change
@@ -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" ]
23 changes: 0 additions & 23 deletions Website/ui/Dockerfile

This file was deleted.

6 changes: 1 addition & 5 deletions docs/development/build-for-production.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@ docker build --platform linux/amd64 -t micropowermanager-laravel-prod -f Docker/
## Frontend Prod

```bash
cd Website/ui
```

```bash
docker build --platform linux/amd64 -t micropowermanager-frontend-prod -f Dockerfile
docker build --platform linux/amd64 -t micropowermanager-ui-prod -f Docker/DockerfileUIProd .
```
Loading