# Clone repository containing both frontend and backend
git clone https://github.com/leduy8103/ecs-cicd-workshop.git
# Use Node.js image
FROM node:16
# Set working directory
WORKDIR /app
# Copy package.json and install dependencies
COPY package.json ./
RUN npm install
# Copy entire source code
COPY . .
# Build application
RUN npm run build
# Use Nginx image to serve the application
FROM nginx:alpine
COPY --from=0 /app/build /usr/share/nginx/html
# Expose port
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
# Use Node.js image
FROM node:16
# Set working directory
WORKDIR /app
# Copy package.json and install dependencies
COPY package.json ./
RUN npm install
# Copy entire source code
COPY . .
# Expose port
EXPOSE 3000
CMD ["node", "index.js"]
Tip: Make sure the Dockerfile has been tested and works properly before proceeding.