├── .gitignore ├── Dockerfile ├── ecr-commands.txt ├── app.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | RUN apk add --no-cache nodejs npm 3 | 4 | WORKDIR /app 5 | COPY package.json /app 6 | RUN npm install 7 | 8 | COPY . /app 9 | 10 | EXPOSE 3000 11 | CMD ["npm", "start"] 12 | -------------------------------------------------------------------------------- /ecr-commands.txt: -------------------------------------------------------------------------------- 1 | // log in to ECR 2 | $(aws ecr get-login --no-include-email --region us-east-1) 3 | 4 | // build the docker image 5 | docker build -t youtube:latest . 6 | 7 | // tag the docker image 8 | docker tag 9 | 10 | // push to ECR 11 | docker push -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const app = express(); 3 | 4 | app.get("/", (req, res) => res.send("Hello Youtube!")); 5 | 6 | app.get("/health", (req, res) => { 7 | res.status(200); 8 | res.send("healthy"); 9 | }); 10 | 11 | app.listen(3000, () => { 12 | console.log("App listening on port 3000!"); 13 | }); 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cicd-container", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "start": "node app.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "express": "^4.17.1" 15 | } 16 | } 17 | --------------------------------------------------------------------------------