Last active
June 23, 2023 14:57
-
-
Save RaimonxDev/4545c64d9d360e4f03afadbd2831c6d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########## App ANGULAR ########### | |
version: "3.3" | |
services: | |
CHANGE_BY_NAME_YOUR_SERVICES: | |
container_name: CHANGE_BY_YOUR_CONTAINER_NAME | |
# CHANGE BY YOUR IMAGE APP-REACT | |
image: plazafrontend/app-angular:lts | |
labels: | |
- "traefik.enable=true" | |
- "traefik.docker.network=traefik" | |
# HABILITAMOS LA CONEXION HTTPS A UN ENTREPOINT | |
- "traefik.http.routers.CHANGE_NAME_ROUTER.entrypoints=CHANGE_BY_YOUR_ENTRYPOINT" | |
- "traefik.http.routers.CHANGE_NAME_ROUTER.rule=Host(`CHANGE_BY_YOUR_DOMAIN`)" | |
- "traefik.http.routers.CHANGE_NAME_ROUTER-https.tls=true" | |
# RESOLVER PARA CREAR EL CERTIFICADO | |
- "traefik.http.routers.CHANGE_NAME_ROUTER.tls.certresolver=CHANGE_BY_YOUR_RESOLVER" | |
networks: | |
- traefik | |
- CHANGE_BY_YOU_NETWORK | |
networks: | |
traefik: | |
external: true | |
CHANGE_BY_YOU_NETWORK: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:lts-alpine3.10 as node | |
RUN mkdir /app | |
COPY package.json package-lock.json /app/ | |
WORKDIR /app | |
# Instala y construye el Angular App | |
RUN npm ci | |
# Copia toda la aplicacion | |
COPY ./ /app/ | |
RUN npm run build:ssr | |
# Angular app construida, la vamos a hostear un server production, este es Nginx | |
FROM nginx:1.19.0-alpine | |
COPY --from=node /app/dist/app-angular/browser/ /usr/share/nginx/html | |
COPY ./nginx.conf /etc/nginx/conf.d/default.conf | |
FROM node:lts-alpine3.10 AS ssr-server | |
COPY --from=node /app/dist /app/dist/ | |
COPY /package.json /app/package.json | |
WORKDIR /app | |
EXPOSE 4000 | |
CMD npm run serve:ssr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/ambroisemaupate/bce4b760405558f358ae | |
add_header X-Frame-Options SAMEORIGIN; | |
add_header X-Content-Type-Options nosniff; | |
add_header X-XSS-Protection "1; mode=block"; | |
# add_header Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline' 'unsafe-eval'; script-src 'self' https://www.googletagmanager.com https://ssl.google-analytics.com; img-src 'self' data: https://ssl.google-analytics.com; object-src 'self'; connect-src 'self' http://localhost/"; | |
## | |
# `gzip` Settings | |
# | |
# | |
gzip on; | |
# Disable compression for Internet Explorer versions 1-6 | |
gzip_disable "msie6"; | |
# Tells proxies to cache both gzipped and regular versions of a resource | |
gzip_vary on; | |
# Compress data even for clients that are connecting via proxies | |
gzip_proxied any; | |
# Sets a gzip compression level of a response. Acceptable values are in the range from 1 to 9. | |
gzip_comp_level 6; | |
# Sets the number and size of buffers used to compress a response. This is either 4K or 8K, depending on a platform. | |
gzip_buffers 16 8k; | |
gzip_http_version 1.1; | |
# Informs NGINX to not compress anything smaller than the defined size | |
gzip_min_length 256; | |
# Enables the types of files that can be compressed | |
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript; | |
server { | |
listen 80; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html; | |
try_files $uri $uri/ /index.html =404; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment