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,
Dockerfile
# build stageFROM node:lts-alpine as build-stageLABEL maintainer="servers@xpl.com"WORKDIR /appCOPY package*.json ./RUN npm installCOPY . ./RUN npm run build# production stageFROM nginx:stable-alpineLABEL maintainer="servers@xpl.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.
i.e
VUE_APP_API_ENDPOINT_DOMAIN=VUE_APP_API_ENDPOINT_DOMAIN
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.