✨ feat(docker): add Docker configuration files
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
# compiled output
|
||||||
|
.vscode
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
npm-debug.log
|
||||||
|
.npmrc
|
||||||
|
|
||||||
|
# git
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.github
|
||||||
|
|
||||||
|
# code formatter
|
||||||
|
.eslintrc
|
||||||
|
.eslintignore
|
||||||
|
.editorconfig
|
||||||
|
.huskyrc
|
||||||
|
.lintstagedrc.json
|
||||||
|
.prettierrc
|
||||||
|
|
||||||
|
# test
|
||||||
|
jest.config.js
|
||||||
|
|
||||||
|
# docker
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
.dockerignore
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
ARG PRODUCTION_IMAGE=nginx:alpine
|
||||||
|
ARG BASE_IMAGE=node:lts
|
||||||
|
|
||||||
|
# --------------> The development image
|
||||||
|
FROM $BASE_IMAGE AS development
|
||||||
|
|
||||||
|
ENV NODE_ENV=development
|
||||||
|
COPY --chown=1000:1000 . /workspaces/m-tartari.github.io
|
||||||
|
WORKDIR /workspaces/m-tartari.github.io
|
||||||
|
USER 1000:1000
|
||||||
|
|
||||||
|
CMD [ "sleep", "infinity" ]
|
||||||
|
|
||||||
|
# --------------> The production build stage
|
||||||
|
FROM $BASE_IMAGE AS production-build
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY . /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
RUN npm run build:prod
|
||||||
|
|
||||||
|
# --------------> The production image
|
||||||
|
FROM ${PRODUCTION_IMAGE} AS production
|
||||||
|
|
||||||
|
# Remove default nginx website
|
||||||
|
RUN rm -rf html; mkdir html
|
||||||
|
|
||||||
|
COPY --from=production-build /app/dist /usr/share/nginx/html
|
||||||
|
# COPY .htpasswd /usr/share/nginx/html/.htpasswd
|
||||||
|
COPY ./nginx.conf /etc/nginx/
|
||||||
|
|
||||||
|
RUN chmod -R o+r /usr/share/nginx/html
|
||||||
|
WORKDIR /usr/share/nginx
|
||||||
|
|
||||||
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: git.m-tartari.eu/m-tartari.github.io
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
target: production
|
||||||
|
container_name: m-tartari.github.io
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- '8080:8080'
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
user nginx;
|
||||||
|
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
events { worker_connections 1024; }
|
||||||
|
|
||||||
|
http {
|
||||||
|
server {
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
listen 8080;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# # This sets the authentication realm name
|
||||||
|
# auth_basic "Restricted Access";
|
||||||
|
# # This specifies the location of the .htpasswd file
|
||||||
|
# auth_basic_user_file /usr/share/nginx/html/.htpasswd;
|
||||||
|
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_http_version 1.0;
|
||||||
|
gzip_comp_level 5;
|
||||||
|
gzip_types
|
||||||
|
application/atom+xml
|
||||||
|
application/javascript
|
||||||
|
application/json
|
||||||
|
application/rss+xml
|
||||||
|
application/vnd.ms-fontobject
|
||||||
|
application/x-font-ttf
|
||||||
|
application/x-web-app-manifest+json
|
||||||
|
application/xhtml+xml
|
||||||
|
application/xml
|
||||||
|
font/opentype
|
||||||
|
image/svg+xml
|
||||||
|
image/x-icon
|
||||||
|
text/css
|
||||||
|
text/plain
|
||||||
|
text/x-component;
|
||||||
|
gzip_proxied no-cache no-store private expired auth;
|
||||||
|
gzip_min_length 256;
|
||||||
|
gunzip on;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user