Pass Docker Env Variables to Vite Containerized Vue.js on Docker Run

Environment variables can only be used in Vue.js applications at build time and the variables are hardcoded in javascript files during build. When you build docker image for the Vue.js application, you use the same image for test and production environments. But the Vue.js application config values can be different in test and production environments. For example: api url configuration value. Since the variables are different in those environments you must pass the configuration values for test and production environments at docker run:...

September 13, 2023 · 4 min · 768 words · CodeGenos

How to Reduce Node.js Docker Image Size?

I had a web application which is written in Node.js and I wanted to dockerize it. So went to the Node.js official site and found Dockerizing a Node.js web app article. I created the Dockerfile as it says in the article. Then I built the docker image with docker build, the created image size was 1.09GB Dockerfile which produce 1.09GB docker image FROM node:18 # Create app directory WORKDIR /usr/src/app # Install app dependencies # A wildcard is used to ensure both package....

August 30, 2023 · 4 min · 646 words · CodeGenos

Build Multi Platform Docker Images with Buildx

Intro I developed a node.js application and i wanted to run it on Raspberry Pi as docker container. So I built a Docker image using docker build on my machine (Lubuntu 23.04 x64) and pushed it to the Docker registry. Then I logged into Raspberry Pi and pulled the image from docker registry and run the docker container. But it failed to run with exit code 139. Problem Traditionally, when you build a Docker image using docker build, it builds the image for the architecture of the machine you’re running the docker build command on....

August 27, 2023 · 4 min · 670 words · CodeGenos