Skip to content

Using a smaller base image for the frontend service #55

@nooreldeensalah

Description

@nooreldeensalah

Hello,
The frontend service uses beevelop/ionic as its base image. The issue is, that this base image size is 3.39 GB, it comes with unnecessary dependencies such as Cordova and Android.

We can use a relatively much smaller base image, consisting of only node, for example, you can use node:14.15.5-alpine3.13 which has the size of roughly only 40 MB, and then install the ionic CLI dependency.

An example alternative Dockerfile would be

## Build
FROM node:14.15.5-alpine3.13 as build
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
RUN npm ci
RUN npm install -g @ionic/cli
# Bundle app source
COPY . .
RUN ionic build
## Run 
FROM nginx:alpine
#COPY www /usr/share/nginx/html
COPY --from=build /usr/src/app/www /usr/share/nginx/html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions