Sign inSign up

ccbcit4949/node

By ccbcit4949

•Updated almost 2 years ago

COMP 4964, ass 2

Image
Web servers
0

10K+

ccbcit4949/node repository overview

Dockerfile:

FROM node:22-alpine3.19

WORKDIR /app

RUN mkdir html
RUN touch html/index.html
RUN touch index.js

RUN echo -e 'const express = require("express");\n\
const app = express();\n\
const port = 80;\n\
\
app.get("/", (req, res) => {\n\
  res.sendFile(__dirname + "/html/index.html");\n\
})\n\
\
app.listen(port);\n' >> index.js

RUN echo '<!DOCTYPE html>\
<html lang="en">\
  <head>\
    <meta charset="UTF-8" />\
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />\
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />\
    <title>S3 Website</title>\
  </head>\
  <body>\
      <h1 style="text-align: center;">Welcome to S3 Website</h1>\
      <div style="display: flex; justify-content: center; column-gap: 20px;">\
        <img src="https://ass-2-bucket.s3.us-west-2.amazonaws.com/A-Cat.jpg" width="200px"></img>\
        <img src="https://ass-2-bucket.s3.us-west-2.amazonaws.com/Cat_img.jpg" width="200px"></img>\
        <img src="https://ass-2-bucket.s3.us-west-2.amazonaws.com/June_odd-eyed-cat.jpg" width="200px"></img>\
      </div>\
</body>\
</html>' >> html/index.html


RUN npm init -y
RUN npm install express


EXPOSE 80

CMD ["node", "index.js"]

Tag summary

Content type

Image

Digest

sha256:4ffe41583…

Size

53.1 MB

Last updated

almost 2 years ago

docker pull ccbcit4949/node