Commit 09bf7f1b authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼

build node application with Docker

parent 355e5243
node_modules/
doc/
npm-debug.log
FROM nginx:stable-alpine
FROM node:8.2
# Copy frontend files and make them accesible to nginx
RUN mkdir /www
COPY build /www
RUN chown nginx:nginx -R /www
RUN chmod -R 0755 /www
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Copy nginx configuration
COPY etc/nginx/villas.conf /etc/nginx/conf.d/default.conf
# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install
VOLUME /usr/src/app/build
# Bundle app source
COPY . /usr/src/app
RUN npm run build
EXPOSE 80
CMD [ "npm", "start" ]
......@@ -8,14 +8,23 @@ networks:
villas:
services:
# The VILLASweb frontend
# Build the frontend with node into a Docker volume
# This container does nothing useful beside providing an
# assets container to the nginx service
frontend:
build:
context: .
command: "/bin/true"
nginx:
image: nginx:stable-alpine
ports:
- "80:80"
- "443:443"
restart: always
volumes:
- "./etc/nginx/villas.conf:/etc/nginx/conf.d/default.conf"
volumes_from:
- frontend
networks:
villas:
......
......@@ -27,7 +27,7 @@ server {
# frontend location
location / {
root /www;
root /usr/src/app/build/;
}
# error pages
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment