Skip to content

Instantly share code, notes, and snippets.

@ltlian
Created October 10, 2021 14:42
Show Gist options
  • Save ltlian/73800f865d86469d7ecbbeafbbe511f6 to your computer and use it in GitHub Desktop.
Save ltlian/73800f865d86469d7ecbbeafbbe511f6 to your computer and use it in GitHub Desktop.
Container definitions for running Vue CLI and Quasar Cli
FROM node:16-alpine3.14
WORKDIR /quasar-setup
RUN yarn global add @quasar/cli
RUN deluser --remove-home node
ARG USER_ID
ARG GROUP_ID
RUN addgroup -S $GROUP_ID && adduser -S -u $USER_ID -G $GROUP_ID scaffold-user
USER scaffold-user
ENTRYPOINT [ "sh" ]
# Once inside the container, we can start scaffolding our
# app using the command below.
# > quasar create <app_name>
FROM node:16-alpine3.14
WORKDIR /vue-setup
RUN yarn global add @vue/cli
RUN deluser --remove-home node
ARG USER_ID
ARG GROUP_ID
RUN addgroup -S $GROUP_ID && adduser -S -u $USER_ID -G $GROUP_ID scaffold-user
USER scaffold-user
ENTRYPOINT [ "sh" ]
# Once inside the container, we can start scaffolding our
# app using the command below.
# > vue create <app_name>

VueJS scaffolding containers

These dockerfiles will build container images which allow you to run Vue CLI or Quasar CLI to scaffold new projects in the hosting filesystem.

The images will not host a development server or build the actual application.

These dockerfiles are modifications of an example found in the article A step-by-step guide to develop and deploy Vue apps with docker, part one.

Building and running the images

In order for us to be able to write to the hosting filesystem while inside the container, we create a user when the image is built based on our current session's user by passing the appropriate build arguments.

Vue CLI

docker build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t vue_cli - < ./setup-vuejs.Dockerfile

docker run -v <local-folder>/:/vue-setup -it vue_cli

Quasar CLI

docker build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t quasar_cli - < ./setup-quasarjs.Dockerfile

docker run -v <local-folder>/:/quasar-setup -it quasar_cli

Once inside either container, run vue create <app_name> or quasar create <app_name> to start scaffolding your application.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment