Skip to content

alpine-ionic

Legacy Image

This image still uses the old-style format for Dockerfiles/makefile recipes, that may (or may not) be compatible with the newer image sources. The container should keep working as expected, but for building new images, a significant part of the code needs to be updated.

gh_commit status gh_stars gh_forks gh_watches gh_issues gh_pr
dh_pulls dh_stars dh_size:x86_64

Container for Alpine Linux + S6 + NodeJS + Ionic CLI


This image containerizes the ionic command line tool and Cordova along with its NPM dependencies to initialize, scaffold and develop Ionic/Angular applications.

Does not include any application build environments, e.g for Android build environment, JDK/JRE or Android Tools or Gradle. This image is to be used for developing apps only.

Based on Alpine Linux from the nodejs image with the @ionic/cli package installed in it.


Get the Image

Pull the image for your architecture if it's already available from Docker Hub.

docker pull woahbase/alpine-ionic
Image Tags

The image is tagged respectively for the following architectures,

latest tag is retagged from x86_64, so pulling without any tag fetches you that image. For any other architectures specify the tag for that architecture. e.g. for armv8 or aarch64 host it is alpine-ionic:aarch64.


Run

We can call ionic commands directly on the container, or run bash in the container to get a user-scoped shell,

docker run --rm -it \
  --name docker_ionic \
  --workdir /home/alpine/project \
  -v $PWD:/home/alpine/project \
woahbase/alpine-ionic:x86_64 \
  --version
docker run --rm -it \
  --entrypoint /bin/bash \
  --name docker_ionic \
  --workdir /home/alpine/project \
  -p 8100:8100 \
  -v $PWD/project:/home/alpine/project \
woahbase/alpine-ionic:x86_64

Configuration

  • Mount the project directory (where package.json is) at /home/alpine/project. Mounts $PWD/project by default.

  • Ionic runs under the user alpine.


Common Recipes

The usual ionic stuff. e.g

Initialize projects with

docker run --rm -it \
  --name docker_ionic \
  --workdir /home/alpine/project \
  -p 8100:8100 \
  -v $PWD/project:/home/alpine/project \
woahbase/alpine-ionic:x86_64 \
  start

Run the dev server,

docker run --rm -it \
  --name docker_ionic \
  --workdir /home/alpine/project \
  -p 8100:8100 \
  -v $PWD/project:/home/alpine/project \
woahbase/alpine-ionic:x86_64 \
  serve

To use npm scripts from package.json, change the entrypoint to npm, e.g. to start the dev server of an Angular-Starter project

docker run --rm -it \
  --entrypoint npm \
  --name docker_ionic \
  --workdir /home/alpine/project \
  -p 8100:8100 \
  -v $PWD/project:/home/alpine/project \
woahbase/alpine-ionic:x86_64 \
  start


Build Your Own

Feel free to clone (or fork) the repository and customize it for your own usage, build the image for yourself on your own systems, and optionally, push it to your own public (or private) repository.

Here's how...


Setting up


Before we clone the /repository, we must have Git, GNU make, and Docker (optionally, with buildx plugin for multi-platform images) setup on the machine. Also, for multi-platform annotations, we might require enabling experimental features of Docker.

Clone the repo with,

git clone https://github.com/woahbase/alpine-ionic
cd alpine-ionic

Always Check Before You Make!

Did you know, we could check what any make target is going to execute before we actually run them, with

make -n <targetname> <optional args>

Build and Test


To create the image for your architecture, run the build and test target with

make build test 

For building an image that targets another architecture, it is required to specify the ARCH parameter when building. e.g.

make build test ARCH=x86_64 

Make to Run


Running the image creates a container and either starts a service (for service images) or provides a shell (can be either a root-shell or usershell) to execute commands in, depending on the image. We can run the image with

make run 

But if we just need a root-shell in the container without any fance pre-tasks (e.g. for debug or to test something bespoke), we can run bash in the container with --entrypoint /bin/bash. This is wrapped in the makefile as

make shell 
Nothing vs All vs Run vs Shell

By default, if make is run without any arguments, it calls the target all. In our case this is usually mapped to the target run (which in turn may be mapped to shell).

There may be more such targets defined as per the usage of the image. Check the makefile for more information.


Push the Image


If the build and test steps finish without any error, and we want to use the image on other machines, it is the next step push the image we built to a container image repository (like /hub), for that, run the push target with

make push 

If the built image targets another architecture then it is required to specify the ARCH parameter when pushing. e.g.

make push ARCH=x86_64 

That's all folks! Happy containerizing!


Maintenance

Sources at Github. Images at Docker Hub.

Maintained (or sometimes a lack thereof?) by WOAHBase.