I would like to Dockerize my existing vuejs app for staging , production and I used multi staged approach to create my app container and I'm using Ubuntu 18.04 and this is my,
# build stage FROM node:lts-alpine as build-stage LABEL maintainer="firstname.lastname@example.org" WORKDIR /app COPY package*.json ./ RUN npm install COPY . ./ RUN npm run build # production stage FROM nginx:stable-alpine LABEL maintainer="email@example.com" COPY --from=build-stage /app/dist/ /app/dist/ COPY nginx/nginx.conf /etc/nginx/ EXPOSE 80
I don't want to create
docker-compose.yml file to assign anything and my question would be like , Create
.env file with hardcoded values.
1 .When running npm run build it'll put VUE_APP_API_ENDPOINT_DOMAIN in the dest files.
2 .We need to know which file. Probably index.html I believe.
3 .We create entry-point.sh script will get all env variables starting with
VUE_APP_ and take it's value. And then using
sed command we find and replace those hard coded variable placeholders in index.html.
And finally start Nginx.
I was stuck on step 3.