1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

build node application with Docker

This commit is contained in:
Steffen Vogel 2017-07-22 04:03:10 +02:00
parent 355e524348
commit 09bf7f1b38
4 changed files with 30 additions and 11 deletions

View file

@ -1,2 +1,3 @@
node_modules/ node_modules/
doc/ doc/
npm-debug.log

View file

@ -1,10 +1,19 @@
FROM nginx:stable-alpine FROM node:8.2
# Copy frontend files and make them accesible to nginx # Create app directory
RUN mkdir /www RUN mkdir -p /usr/src/app
COPY build /www WORKDIR /usr/src/app
RUN chown nginx:nginx -R /www
RUN chmod -R 0755 /www
# Copy nginx configuration # Install app dependencies
COPY etc/nginx/villas.conf /etc/nginx/conf.d/default.conf 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" ]

View file

@ -8,14 +8,23 @@ networks:
villas: villas:
services: 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: frontend:
build: build:
context: . context: .
command: "/bin/true"
nginx:
image: nginx:stable-alpine
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
restart: always volumes:
- "./etc/nginx/villas.conf:/etc/nginx/conf.d/default.conf"
volumes_from:
- frontend
networks: networks:
villas: villas:

View file

@ -27,7 +27,7 @@ server {
# frontend location # frontend location
location / { location / {
root /www; root /usr/src/app/build/;
} }
# error pages # error pages