Hello Fellow Programmer,
For a project we created an Angular 2, which will be our GUI. This GUI will get his Data from a Backend-API hosted at Amazon Web Services (AWS).
The GUI should run also on AWS, we thougt about running it as an Docker container on an EC2.
The GUI works fine on my PC but im not able to make a prober Docker container, which work neither on my pc or on AWS.
Do you guys know a good Tutorial / Hello World Project where i can learn how to create an Angular 2 app in Docker?
Some more information how im trying to do this:
my Dockerfile
# Create image based off of the official Node 6 image
FROM node:6
# Create a directory where our app will be placed
RUN mkdir -p /usr/src/app
# Change directory so that our commands run inside this new dir
WORKDIR /usr/src/app
# Copy dependency definitions
COPY package.json /usr/src/app
# Install dependecies
RUN npm install
# Get all the code needed to run the app
COPY . /usr/src/app
# Expose the port the app runs in
EXPOSE 4200
# Serve the app
CMD ["npm", "start"]
change the package.json
{
...
"scripts": {
"start": "ng serve -H 0.0.0.0",
...
},
...
}
run docker build -t gui:test .
run docker run --name gui -p 4200:4200 gui:test
if i did it correctly localhost:4200 should show me my running Angluar 2 app, which he does not.
Edit:
The ip given from the demon with the Port doesnt work aswell 192.168.99.100:4200
ng build --productionand serve this using a webserver like nginx or apache. This prevents to provide the entire typescript code in the docker imagedistdirectory and copy it to nginxnginx/html/and build an nginx docker container, am i right?