This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from IBM-Cloud/dev
Knative exploration
- Loading branch information
Showing
6 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Client | ||
.DS_STORE | ||
node_modules | ||
dist | ||
coverage/ | ||
.nyc_output/ | ||
*.log | ||
.env | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |