Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #136 from IBM-Cloud/dev
Browse files Browse the repository at this point in the history
Knative exploration
  • Loading branch information
l2fprod committed Oct 22, 2018
2 parents ed168e7 + 3a9fe2f commit cbb06cb
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .dockerignore
@@ -0,0 +1,9 @@
# Client
.DS_STORE
node_modules
dist
coverage/
.nyc_output/
*.log
.env
.git
20 changes: 20 additions & 0 deletions Dockerfile
@@ -0,0 +1,20 @@
# build
FROM node:6-alpine AS build

WORKDIR /app
COPY . .

ARG CONTROLLER_SERVICE=http://lw-controller:8080
ENV CONTROLLER_SERVICE="${CONTROLLER_SERVICE}"

RUN cd /app \
&& apk add --no-cache --virtual .build-deps alpine-sdk python \
&& npm install \
&& npm run deploy:prod \
&& apk del .build-deps

# run
FROM nginx:stable

COPY --from=build /app/dist/ /var/www/
COPY --from=build /app/dist/docker-nginx.conf /etc/nginx/conf.d/default.conf
24 changes: 24 additions & 0 deletions onestep.Dockerfile
@@ -0,0 +1,24 @@
# similar to Dockerfile, but uses Apache HTTPd and does not use multi-stage build
FROM httpd:2.4

ARG CONTROLLER_SERVICE=http://lw-controller:8080
ENV CONTROLLER_SERVICE="${CONTROLLER_SERVICE}"
RUN echo "Using ${CONTROLLER_SERVICE}"

WORKDIR /app
COPY . .

RUN apt-get update \
&& apt-get install -y curl gnupg \
&& (curl -sL https://deb.nodesource.com/setup_8.x | bash -) \
&& apt-get update \
&& apt-get install -y python build-essential nodejs \
&& npm install \
&& npm run deploy:prod \
&& rm -rf node_modules \
&& mv -f /app/dist/* /usr/local/apache2/htdocs/ \
&& apt-get remove -y python build-essential nodejs curl

# Listen on 8080
RUN sed -i "s/Listen 80/Listen 8080/g" /usr/local/apache2/conf/httpd.conf
EXPOSE 8080
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -116,7 +116,7 @@
"koa-static": "3.0.0",
"material-ui": "0.16.7",
"moment": "2.20.1",
"node-sass": "3.13.1",
"node-sass": "4.9.3",
"nodemon": "1.14.9",
"normalize.css": "4.2.0",
"postcss-loader": "0.9.1",
Expand Down
11 changes: 11 additions & 0 deletions src/static/.htaccess
@@ -0,0 +1,11 @@
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]

</IfModule>
29 changes: 29 additions & 0 deletions src/static/docker-nginx.conf
@@ -0,0 +1,29 @@
server {
listen 80 default_server;
server_name localhost;

root /var/www;
index index.html index.htm;

location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
# access_log logs/static.log; # I don't usually include a static log
}

location ~* \.(?:css|js)$ {
try_files $uri =404;
expires 1y;
add_header Cache-Control "public";
access_log off;
}

# Any route containing a file extension (e.g. /devicesfile.js)
location ~ ^.+\..+$ {
try_files $uri =404;
}

# Any route that doesn't have a file extension (e.g. /devices)
location / {
try_files $uri $uri/ /index.html;
}
}

0 comments on commit cbb06cb

Please sign in to comment.