mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
build(docker): Create docker configuration
- Add Dockerfile to build angular file and serve with nginx - Add nginx conf file to serve builded angular files when image run - Add dockerignore to limit docker context
This commit is contained in:
parent
b99efd0f37
commit
0eb57aae41
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@ -0,0 +1,8 @@
|
||||
.angular/
|
||||
node_modules/
|
||||
dist/
|
||||
docs/
|
||||
e2e/
|
||||
**/*.log
|
||||
**/.DS_Store
|
||||
**/Thumbs.db
|
27
docker/Dockerfile
Normal file
27
docker/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
# Create stage to build angular application
|
||||
FROM node:18.15.0-alpine AS angular-builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json .
|
||||
|
||||
RUN yarn install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN yarn run build:prod
|
||||
|
||||
# Build NGINX Image to serve builded files
|
||||
FROM nginx:stable-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Copy dist folder fro build stage to nginx public folder
|
||||
COPY --from=angular-builder /app/dist/framadate /app
|
||||
|
||||
# Start NgInx service
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
58
docker/nginx/nginx.conf
Normal file
58
docker/nginx/nginx.conf
Normal file
@ -0,0 +1,58 @@
|
||||
worker_processes 1;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /tmp/nginx.pid;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
client_body_temp_path /tmp/client_temp;
|
||||
proxy_temp_path /tmp/proxy_temp_path;
|
||||
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||
scgi_temp_path /tmp/scgi_temp;
|
||||
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;
|
||||
keepalive_timeout 65;
|
||||
|
||||
gzip on;
|
||||
gzip_static on;
|
||||
gzip_vary on;
|
||||
gzip_proxied no-cache no-store private expired auth;
|
||||
gzip_min_length 10240;
|
||||
gzip_types
|
||||
application/javascript
|
||||
application/json
|
||||
font/woff2
|
||||
text/css
|
||||
text/plain;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
location / {
|
||||
root /app;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
location ~* (\.html|\/sw\.js)$ {
|
||||
root /app;
|
||||
expires -1y;
|
||||
add_header Pragma "no-cache";
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|json)$ {
|
||||
root /app;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user