Browse Source

feat: add Docker file and CD

tags/v1.2.0
Dany Sluijk 8 months ago
parent
commit
3a3cf1c3b1
Signed by: dsluijk GPG Key ID: EEEBA79CCB6729B0
5 changed files with 109 additions and 0 deletions
  1. +4
    -0
      .drone.yml
  2. +7
    -0
      .releaserc
  3. +45
    -0
      Dockerfile
  4. +52
    -0
      nginx.conf
  5. +1
    -0
      package.json

+ 4
- 0
.drone.yml View File

@@ -69,6 +69,10 @@ steps:
from_secret: DEPLOY_IV
GIT_COMMITTER_EMAIL: robot@dany.dev
GIT_COMMITTER_NAME: Drone CI
DOCKER_USERNAME:
from_secret: REGISTRY_USERNAME
DOCKER_PASSWORD:
from_secret: REGISTRY_PASSWORD

trigger:
branch:


+ 7
- 0
.releaserc View File

@@ -19,6 +19,13 @@
"CHANGELOG.md"
]
}
],
[
"semantic-release-docker",
{
"name": "teenyui/teenyui",
"registryUrl": "harbor.dany.dev"
}
]
]
}

+ 45
- 0
Dockerfile View File

@@ -0,0 +1,45 @@
# Use the NodeJS image as builder
FROM node:lts AS builder

# Create the workspace
RUN mkdir -p /usr/src/app/example
WORKDIR /usr/src/app

# Copy over the package, and install the dependencies
COPY package.json /usr/src/app
COPY example/package.json /usr/src/app/example
RUN yarn
WORKDIR /usr/src/app/example
RUN yarn
WORKDIR /usr/src/app

# Copy over the other files.
COPY src /usr/src/app/src
COPY theme /usr/src/app/theme
COPY rollup.config.js /usr/src/app
COPY tsconfig.json /usr/src/app

# Build the application
RUN yarn build

# Switch to the example folder
WORKDIR /usr/src/app/example

# Copy over the other files.
COPY example/.sassrc /usr/src/app/example
COPY example/tsconfig.json /usr/src/app/example
COPY example/src /usr/src/app/example/src

# Build the example
RUN yarn build

# The actual server, this builds the final image
FROM nginx:alpine

# Copy the nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf

# Copy the output of the builder
COPY --from=builder /usr/src/app/example/dist /usr/share/nginx/html
RUN chown nginx:nginx /usr/share/nginx/html/ -R
EXPOSE 80

+ 52
- 0
nginx.conf View File

@@ -0,0 +1,52 @@
events {
worker_connections 4096;
}

http {
# Set the index
index index.html;
include mime.types;
default_type application/octet-stream;

# Make sure client side routing still works
proxy_intercept_errors on;
error_page 404 = /index.html;

# Optimize request data
client_max_body_size 2m;
client_body_buffer_size 128k;

# Set open file cache
open_file_cache max=10000 inactive=5m;
open_file_cache_valid 10m;
open_file_cache_min_uses 1;
open_file_cache_errors on;

# Enable GZip of files GZipped during build.
gzip_static on;

# Enable on-the-fly GZip for files not GZipped on build time.
gzip on;
gzip_buffers 64 8k;
gzip_comp_level 9;
gzip_disable "msie6";
gzip_http_version 1.1;
gzip_types text/plain application/javascript application/json;

# Add a few security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload" always;
add_header Content-Security-Policy "default-src 'self'" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Frame-Options DENY always;

server {
# Create the server
listen 80;
root /usr/share/nginx/html;

# Add cache expiration
expires 3h;
add_header Cache-Control "public";
}
}

+ 1
- 0
package.json View File

@@ -34,6 +34,7 @@
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"sass": "^1.29.0",
"semantic-release-docker": "^2.2.0",
"stylelint": "^13.7.2",
"stylelint-config-sass-guidelines": "^7.1.0",
"typescript": "^4.0.5"


Loading…
Cancel
Save