Skip to content

Commit b4ddeb3

Browse files
committed
Add Dockerfile for running Komodo website. Does NOT use ko-deploy
1 parent 3891fff commit b4ddeb3

5 files changed

+183
-0
lines changed

Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM nginx:1.15.4
2+
RUN apt-get update \
3+
&& apt-get install -qy --no-install-recommends dirmngr git curl ca-certificates procps gnupg2 build-essential \
4+
&& rm -rf /var/lib/apt/lists/* \
5+
&& apt-get clean
6+
7+
# Node
8+
ARG nodeVer="v0.10.25"
9+
ARG nodeDir="node-$nodeVer-linux-x64"
10+
ARG nodeBin="$PWD/$nodeDir/bin"
11+
ARG nodeTar="$nodeDir.tar.gz"
12+
ARG nodeURL="https://nodejs.org/dist/$nodeVer/$nodeTar"
13+
RUN curl -O $nodeURL
14+
RUN tar xf $nodeTar
15+
ENV PATH=$nodeBin:$PATH
16+
# Ruby
17+
ARG rubVers="2.3.1"
18+
RUN mkdir ~/.gnupg
19+
RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
20+
RUN gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
21+
RUN curl -sSL https://get.rvm.io | bash -s
22+
RUN /bin/bash -l -c ". /etc/profile.d/rvm.sh && rvm install $rubVers"
23+
# Site
24+
ARG baseDir="/deployment"
25+
ARG komodoSiteDir="$baseDir/komodo-site"
26+
WORKDIR $komodoSiteDir
27+
ADD . .
28+
RUN mv nginx.conf /etc/nginx/
29+
RUN mkdir /etc/nginx/sites-enabled
30+
RUN cp community-sites-enabled /etc/nginx/sites-enabled/community
31+
32+
EXPOSE 5000
33+
RUN echo " something"
34+
CMD ["$komodoSiteDir/generate-site-from-resources.sh"]
35+
# The entry point here is an initialization process,
36+
# it will be used as arguments for e.g.
37+
# `docker run` command
38+
ENTRYPOINT ["/bin/bash", "-l", "-c"]

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,17 @@ You only need to run `middleman resources` when you want to pull in the latest r
1919
The export stuff for GITHUB is to authenticate witht he API, and only necessary if you intend to run `middleman resources`
2020

2121
When running `middleman server` you can access the site from `http://dev.komodoide.com:4567`
22+
23+
# Running it with DOCKER
24+
25+
Build the image:
26+
$ docker build --rm . -t komodo-website
27+
Start the image:
28+
$ docker run -d --env komodo-website
29+
30+
### Docker Run Trouble
31+
32+
If you get an error about hitting github api limits when you `docker run` you'll need to get a
33+
`GITHUB_ID` and `GITHUB_SECRET` from your [Github account settings](https://github.com/settings/developers).
34+
You can set them as env vars in your terminal then pass them into the running container like so:
35+
$ ocker run -d --env GITHUB_ID=$GITHUB_ID --env GITHUB_SECRET=$GITHUB_SECRET komodo-website

community-sites-enabled

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
server {
2+
listen 80;
3+
4+
server_name community.komodoide.com;
5+
6+
location ~ ^/(customize|packages|asset/|json/) {
7+
index index.html;
8+
root /deployment/komodo-website/live;
9+
}
10+
11+
location / {
12+
proxy_pass http://0.0.0.0:8080;
13+
proxy_set_header Host $host;
14+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
15+
proxy_set_header X-Forwarded-Proto https;
16+
proxy_set_header X-Real-IP $remote_addr;
17+
}
18+
}
19+
20+
server {
21+
listen 80;
22+
23+
server_name forum.komodoide.com;
24+
25+
location / {
26+
return 301 http://community.komodoide.com$request_uri;
27+
}
28+
}

generate-site-from-resources.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rvm use $rubVers
2+
rm -Rf data/resources/*
3+
bundle install
4+
bundle exec middleman resources
5+
bundle exec middleman build
6+
rm -Rf live
7+
mv build live

nginx.conf

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
user www-data;
2+
worker_processes 4;
3+
pid /run/nginx.pid;
4+
5+
events {
6+
worker_connections 768;
7+
# multi_accept on;
8+
}
9+
10+
http {
11+
12+
fastcgi_param HTTP_PROXY "";
13+
##
14+
# Basic Settings
15+
##
16+
17+
sendfile on;
18+
tcp_nopush on;
19+
tcp_nodelay on;
20+
keepalive_timeout 65;
21+
types_hash_max_size 2048;
22+
# server_tokens off;
23+
24+
# server_names_hash_bucket_size 64;
25+
# server_name_in_redirect off;
26+
27+
include /etc/nginx/mime.types;
28+
default_type application/octet-stream;
29+
30+
##
31+
# Logging Settings
32+
##
33+
34+
access_log /var/log/nginx/access.log;
35+
error_log /var/log/nginx/error.log;
36+
37+
##
38+
# Gzip Settings
39+
##
40+
41+
gzip on;
42+
gzip_disable "msie6";
43+
44+
# gzip_vary on;
45+
# gzip_proxied any;
46+
# gzip_comp_level 6;
47+
# gzip_buffers 16 8k;
48+
# gzip_http_version 1.1;
49+
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
50+
51+
##
52+
# nginx-naxsi config
53+
##
54+
# Uncomment it if you installed nginx-naxsi
55+
##
56+
57+
#include /etc/nginx/naxsi_core.rules;
58+
59+
##
60+
# nginx-passenger config
61+
##
62+
# Uncomment it if you installed nginx-passenger
63+
##
64+
65+
#passenger_root /usr;
66+
#passenger_ruby /usr/bin/ruby;
67+
68+
##
69+
# Virtual Host Configs
70+
##
71+
72+
include /etc/nginx/conf.d/*.conf;
73+
include /etc/nginx/sites-enabled/*;
74+
}
75+
76+
77+
#mail {
78+
# # See sample authentication script at:
79+
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
80+
#
81+
# # auth_http localhost/auth.php;
82+
# # pop3_capabilities "TOP" "USER";
83+
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
84+
#
85+
# server {
86+
# listen localhost:110;
87+
# protocol pop3;
88+
# proxy on;
89+
# }
90+
#
91+
# server {
92+
# listen localhost:143;
93+
# protocol imap;
94+
# proxy on;
95+
# }
96+
#}

0 commit comments

Comments
 (0)