mirror of
https://github.com/yldio/copilot.git
synced 2024-12-01 07:30:07 +02:00
chore(cp-frontend): restore Dockerfile for demo compose
This commit is contained in:
parent
b3926751ad
commit
20b8b23cbb
19
packages/cp-frontend/Dockerfile
Normal file
19
packages/cp-frontend/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
FROM quay.io/yldio/alpine-node-containerpilot:latest
|
||||||
|
|
||||||
|
RUN apk add --update nginx
|
||||||
|
|
||||||
|
ENV CONTAINERPILOT /etc/containerpilot.json5
|
||||||
|
|
||||||
|
RUN npm install -g npm@^4
|
||||||
|
RUN npm config set loglevel info \
|
||||||
|
&& yarn add lerna@^2.0.0-rc.5
|
||||||
|
|
||||||
|
RUN ./node_modules/.bin/lerna clean --yes --scope joyent-cp-frontend --include-filtered-dependencies \
|
||||||
|
&& ./node_modules/.bin/lerna bootstrap --scope joyent-cp-frontend --include-filtered-dependencies
|
||||||
|
|
||||||
|
COPY packages/cp-frontend/etc/containerpilot.json5 ${CONTAINERPILOT}
|
||||||
|
COPY packages/cp-frontend/etc/nginx.conf.tmpl /etc/nginx/nginx.conf.tmpl
|
||||||
|
|
||||||
|
WORKDIR /opt/app/packages/cp-frontend
|
||||||
|
|
||||||
|
CMD ["/bin/containerpilot"]
|
54
packages/cp-frontend/etc/containerpilot.json5
Normal file
54
packages/cp-frontend/etc/containerpilot.json5
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
consul: 'localhost:8500',
|
||||||
|
jobs: [
|
||||||
|
{
|
||||||
|
name: 'is-built',
|
||||||
|
exec: '[ -d /opt/app/packages/cp-frontend/build/static ]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'build',
|
||||||
|
exec: 'yarn run build',
|
||||||
|
when: {
|
||||||
|
source: 'is-built',
|
||||||
|
once: 'exitFailed'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'config-nginx',
|
||||||
|
exec: 'containerpilot -config /etc/nginx/nginx.conf.tmpl -template -out /etc/nginx/nginx.conf'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cp-frontend',
|
||||||
|
port: {{.PORT}},
|
||||||
|
exec: 'nginx',
|
||||||
|
interfaces: ["eth0", "eth1"],
|
||||||
|
restarts: 'unlimited',
|
||||||
|
when: {
|
||||||
|
source: 'config-nginx',
|
||||||
|
once: 'exitSuccess'
|
||||||
|
},
|
||||||
|
health: {
|
||||||
|
exec: '/usr/bin/curl -o /dev/null --fail -s http://localhost:{{.PORT}}',
|
||||||
|
interval: 5,
|
||||||
|
ttl: 25
|
||||||
|
},
|
||||||
|
tags: [
|
||||||
|
'traefik.backend=cp-frontend',
|
||||||
|
'traefik.frontend.rule=PathPrefix:/',
|
||||||
|
'traefik.frontend.entryPoints={{ .ENTRYPOINTS | default "http,ws,wss" }}'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'consul-agent',
|
||||||
|
exec: ['/usr/local/bin/consul', 'agent',
|
||||||
|
'-data-dir=/data',
|
||||||
|
'-config-dir=/config',
|
||||||
|
'-log-level=err',
|
||||||
|
'-rejoin',
|
||||||
|
'-retry-join', '{{ .CONSUL | default "consul" }}',
|
||||||
|
'-retry-max', '10',
|
||||||
|
'-retry-interval', '10s'],
|
||||||
|
restarts: 'unlimited'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
101
packages/cp-frontend/etc/nginx.conf.tmpl
Normal file
101
packages/cp-frontend/etc/nginx.conf.tmpl
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
user nginx;
|
||||||
|
worker_processes 1;
|
||||||
|
daemon off;
|
||||||
|
|
||||||
|
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||||
|
pcre_jit on;
|
||||||
|
|
||||||
|
# Configures default error logger.
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
# Includes files with directives to load dynamic modules.
|
||||||
|
include /etc/nginx/modules/*.conf;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
# The maximum number of simultaneous connections that can be opened by
|
||||||
|
# a worker process.
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
index index.html index.htm;
|
||||||
|
server {
|
||||||
|
server_name _;
|
||||||
|
listen {{ .PORT | default "80" }} default_server;
|
||||||
|
listen [::]:{{ .PORT | default "80" }} default_server;
|
||||||
|
root /opt/app/packages/cp-frontend/build;
|
||||||
|
location / {
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Includes mapping of file name extensions to MIME types of responses
|
||||||
|
# and defines the default type.
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
# Name servers used to resolve names of upstream servers into addresses.
|
||||||
|
# It's also needed when using tcpsocket and udpsocket in Lua modules.
|
||||||
|
#resolver 208.67.222.222 208.67.220.220;
|
||||||
|
|
||||||
|
# Don't tell nginx version to clients.
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
# Specifies the maximum accepted body size of a client request, as
|
||||||
|
# indicated by the request header Content-Length. If the stated content
|
||||||
|
# length is greater than this size, then the client receives the HTTP
|
||||||
|
# error code 413. Set to 0 to disable.
|
||||||
|
client_max_body_size 1m;
|
||||||
|
|
||||||
|
# Timeout for keep-alive connections. Server will close connections after
|
||||||
|
# this time.
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
# Sendfile copies data between one FD and other from within the kernel,
|
||||||
|
# which is more efficient than read() + write().
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
|
# Don't buffer data-sends (disable Nagle algorithm).
|
||||||
|
# Good for sending frequent small bursts of data in real time.
|
||||||
|
tcp_nodelay on;
|
||||||
|
|
||||||
|
# Causes nginx to attempt to send its HTTP response head in one packet,
|
||||||
|
# instead of using partial frames.
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
# Path of the file with Diffie-Hellman parameters for EDH ciphers.
|
||||||
|
#ssl_dhparam /etc/ssl/nginx/dh2048.pem;
|
||||||
|
|
||||||
|
# Specifies that our cipher suits should be preferred over client ciphers.
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
# Enables a shared SSL cache with size that can hold around 8000 sessions.
|
||||||
|
ssl_session_cache shared:SSL:2m;
|
||||||
|
|
||||||
|
|
||||||
|
# Enable gzipping of responses.
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
# Set the Vary HTTP header as defined in the RFC 2616.
|
||||||
|
gzip_vary on;
|
||||||
|
|
||||||
|
# Enable checking the existence of precompressed files.
|
||||||
|
#gzip_static on;
|
||||||
|
|
||||||
|
|
||||||
|
# Specifies the main log format.
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
# Sets the path, format, and configuration for a buffered log write.
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
|
||||||
|
# Includes virtual hosts configs.
|
||||||
|
# include /etc/nginx/conf.d/*.conf;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user