Angular dockerize is not running on local port?

  angular, docker, node.js

i have an angular app that i am trying to make it dockerize so with the below Dockerfile it is building an image , how do i run this app now locally for the port that i exposed 4200 i am new to docker stuff any help will be appreciated this will be without nginx.

Dockerfile

# --------------------------------------------------------------------------
FROM node:14 as builder
COPY package.json package.json
COPY package-lock.json package-lock.json

RUN  npm install --production 
# --------------------------------------------------------------------------

FROM gcr.io/distroless/nodejs:14

USER 9000:9000

# create the base directory
WORKDIR /apps/nodejs/gcp/

ENV HOME=/apps/nodejs/gcp/
# set the home directory

COPY --from=builder node_modules ./node_modules

COPY package.json ./

# copy readme.md
COPY README.md ./
# copy the dist to the home dir
COPY dist ./dist

# DO NOT COPY THE CERTS AND CONFIG FOLDER IN THIS IMAGE. THESE WILL BE INJECTED BY KUBERNETES.
# IN ORDER TO RUN THIS IMAGE IN LOCAL MOUNT THE HOST NODECERT AND CONFIG FOLDER TO THE DOCKER
# docker run -p 9082:9082 --rm 
#--env "NO_UPDATE_NOTIFIER=true NODE_ENV=production PORT=9082 
#LOGCONSOLE=true CONFIGBASEPATH=/apps/nodejs/gcp/config/ CERTSBASEPATH=/apps/nodejs/gcp/nodecerts" 
#-v /apps/nodejs/gcp/nodecerts:/apps/nodejs/gcp/nodecerts -v /apps/nodejs/gcp/config/:/apps/nodejs/gcp/config/ <image name>

# TO GO INSIDE THE RUNNING CONTAINER
# docker container exec -it <container id> sh

#BUILDING Docker
# docker build -t <image name> .
# <image name>: all lowercase and if needed separated by hypen(-). eg redis-service




# port the server will be listening to.
EXPOSE 4200

CMD ng serve –host 0.0.0.0 –port 4200

Source: Docker Questions

LEAVE A COMMENT