Skip to content
Snippets Groups Projects
Commit 6a7cf24f authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

feat(docker): add docker configuration and docker-compose

parent c172ecb3
No related branches found
No related tags found
2 merge requests!7feat: add front office,!3Feat/dockerize
FROM node:14-alpine
# Stage 0, "build-stage", based on Node.js, to build and compile the frontend
FROM node:14-alpine as build-stage
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
RUN yarn
# add app
COPY . ./
# start app
CMD ["yarn", "start"]
COPY package*.json /app/
RUN npm install
COPY ./ /app/
RUN npm run build
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.16
COPY --from=build-stage /app/build/ /usr/share/nginx/html
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/site.pro.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
# Client - LLLE
Projet client du backoffice LLLE
## Local usage
```bash
docker-compose up -d
```
\ No newline at end of file
version: '3.7'
services:
nginx:
image: backoffice #TODO: replace with forge image tag
build:
context: .
restart: unless-stopped
ports:
- 8080:80
version: '3.7'
services:
nginx:
image: nginx:1.16
restart: unless-stopped
volumes:
- ./nginx/site.conf:/etc/nginx/conf.d/default.conf
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
command: ["nginx", "-g", "daemon off;"]
ports:
- 8081:8080
networks:
backoffice:
depends_on:
- front
links:
- front
front:
image: bayesimpact/react-base
restart: unless-stopped
volumes:
- ./:/usr/app
working_dir: /usr/app
ports:
- 3000:3000
networks:
backoffice:
networks:
backoffice:
\ No newline at end of file
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
# Gzip conf
gzip on;
gzip_vary on; # tells proxies to cache both gzipped and regular versions of a resource
gzip_min_length 256; # taille minimale du fichier à compresser
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
include /etc/nginx/conf.d/*.conf;
# Max Body Size
client_max_body_size 2M;
}
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://front:3000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Access-Control-Allow-Origin *;
}
}
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment