I am beginner in Docker and I created this Dockerfile
FROM nginx:1.13-alpine
ENV APP_PATH /app
ENV PATH $APP_PATH/node_modules/@angular/cli/bin/:$PATH
RUN apk add --update --no-cache nodejs && mkdir $APP_PATH && rm -rf /etc/nginx/conf.d/*
WORKDIR $APP_PATH
COPY . .
COPY nginx/default.conf /etc/nginx/conf.d/
RUN npm install \
&& ng build --aot --prod \
&& rm -rf /usr/share/nginx/html/* \
&& mv ./dist/* /usr/share/nginx/html/ \
&& npm cache clean \
&& apk del nodejs libstdc++ libgcc libuv http-parser ca-certificates \
&& rm -rf ./*
CMD ["nginx", "-g", "daemon off;"]
and Nginx config
server {
listen 80;
sendfile on;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ /index.html =404;
}
}
I build image docker build --rm -t appName -f Dockerfile . and run container docker run -it -p 8080:80 appName
Everything is ok. But I have one problem. I can't change my code interactively. I commit my changing docker commit .... I restart my container several times but nothing happened.
I would appreciate any advice.