I am trying to upload image of my angular 9 application into Docker hub
. I have docker extension already installed in my visual studio code, and I connected it to my username and added my account password.
Then, I ran the following command to install docker globally:
npm install -g docker
At the root path of my project, I've created Dockerfile
having the following script:
# Stage 1
FROM node:latest as node
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build --prod
# Stage 2
FROM nginx:alpine
COPY --from=node /app/dist/myproject /usr/share/nginx/html
And then I tried:
FROM 13.13.0-alpine3.10 as build-step
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY . /app/
RUN npm run build
FROM nginx:1.17.10-alpine as prod-step
COPY --from=build-step /app/dist/myproject /usr/share/nginx/html
# COPY /dist/myproject /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
I then tried to build my application using:
docker build --rm -f "Dockerfile" -t myproject:latest "."
And I've got the following response instead of building the app:
Saved file tree to doc-filelist.js
Copied JS to doc-script.js
Compiled CSS to doc-style.css
And a doc
folder has been created. But nothing else has been done.
I tried this solution on stack overflow using docker.js
but I don't think it is the solution I want to build a docker image and upload to docker hub and run it from there.