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:
parent
355e524348
commit
09bf7f1b38
4 changed files with 30 additions and 11 deletions
|
@ -1,2 +1,3 @@
|
|||
node_modules/
|
||||
doc/
|
||||
npm-debug.log
|
||||
|
|
25
Dockerfile
25
Dockerfile
|
@ -1,10 +1,19 @@
|
|||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue