Reputation: 301
I have static html / AngularJS file. I am going to launch web server with nginx inside docker image. How can I build docker image from these html / Js files and configure nginx server?
Upvotes: 0
Views: 467
Reputation: 11184
Try like this :
Step 1 :
You need to create docker file inside the project root.
- myApp/
- Dockerfile
inside the Docker file add below code
FROM nginx:alpine
COPY dist /usr/share/nginx/html
Step 2:
build your project in production mode
Step 3 :
docker login
docker build -t <your registry or image location> .
docker run --name <your project name > -d -p 8080:81 <your registry or image location>
docker push <your registry or image location>
Upvotes: 1
Reputation: 8441
Assuming you have this files :
- myApp/
- index.html
- script.js
You need to launch nginx :
docker run -p 8080:80 -v /pathTo/myApp:/usr/share/nginx/html:ro -d nginx
And then access to with http://localhost:8080
More information on nginx docker image
Upvotes: 1