Should I use docker (nginx) for serving a SPA?

I only have 1 javascript file(bundle.js packed by webpack) and 1 html. It’s kinda like SPA.
I’m thinking how I host this SPA? I already have one clean VM on Amazon EC2.
I was planning setup a docker (Nginx) on this EC2. However, as I said, this VM is clean. Only this SPA will use this EC2 VM.
So I’m confused by this situation. Should I use docker(nginx) or just install a Nginx on this EC2 for serving this SPA?

  • `Authorization Token has expired` issue AWS-CLI on MacOS Sierra
  • Can't connect to Amazon RDS from Docker container
  • AWS Elastic Beanstalk Docker environment variables
  • What is the optimal way to run a Node API in Docker on Amazon ECS?
  • Error “python: not found” in Dockerized PHP application hosted on Elastic Beanstalk
  • docker ubuntu container filesystem
  • docker run ubuntu on mac and nothing happens
  • Docker - access another container on the same machine via its public ip, without docker links
  • Running multiple docker containers in same host
  • openshift v3 sed couldn't open temporary file
  • Use docker to migrate a system
  • What is inside a Docker Ubuntu Image if Docker doesn't encapsulate an OS?
  • 2 Solutions collect form web for “Should I use docker (nginx) for serving a SPA?”

    AWS S3 service is capable of service static files, You just need to upload your files to a bucket, then make them public and note the public URL.

    As a side note, Containerizing apps and using microservices architecture, will give you advantages, Some of them are:

    • Ease of Upgrade
    • Fault Containment
    • Ease of technology change
    • Increased Security
    • Efficient Resource Utilization

    S3 is cheap enough for static files, almost free compared to EC2 unless you have backend in place. You can use Cyberduck for S3 and if you want to go FTP one day, same app would give you a common UX for uploading your files.

    Though Docker setup would be over engineering for static serving in IaaS, you would need to build an image that contains nginx and your files as in KyleAMathews/docker-nginx project.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.