This guide provides step-by-step instructions for setting up an Angular project from scratch on an Ubuntu machine.
sudo apt update
sudo apt install nodejs npmnode -v
npm -vsudo npm install -g @angular/[email protected]ng --versionnpm install
ng build
cd dist/angular-frontend
ng serve --host 0.0.0.0 --port=80Transfer the contents of the dist/ directory to your server or hosting provider to make your Angular application available to users.
This guide provides step-by-step instructions for Dockerizing an existing Angular project. Docker allows you to package your Angular application into a container, making it portable and easily deployable across different environments.
- Docker installed on your system. You can download and install Docker Desktop from here.
Create a Dockerfile in the root directory of your Angular project with the following content:
# Use official Node.js image as the base image
FROM node:14-alpine as build
# Set the working directory in the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install project dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the Angular application
RUN npm run build
# Use NGINX as the production server
FROM nginx:alpine
# Copy the built artifact from the previous stage to NGINX web server directory
COPY --from=build /usr/src/app/dist/angular-frontend /usr/share/nginx/html
# Expose port 80 to the outside world
EXPOSE 80
# Start NGINX server when the container starts
CMD ["nginx", "-g", "daemon off;"]
#########################################
#cd /src/app/services
#vim worker.services.ts
[ in the place of Localhost you have to write your instace IP any one of them public/privet.
#after that build dockerfile
#create container
#To chek hit on tne browser IP:80