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 #135 from IBM-Cloud/docker
Browse files Browse the repository at this point in the history
Docker image for knative
  • Loading branch information
l2fprod committed Oct 3, 2018
2 parents 4dd2f92 + 1d62371 commit ef0f4b3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
22 changes: 14 additions & 8 deletions onestep.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# build
FROM nginx:stable-alpine
# 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 apk add --no-cache --virtual .build-deps nodejs alpine-sdk python \
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 \
&& apk del .build-deps
&& rm -rf node_modules \
&& mv -f /app/dist/* /usr/local/apache2/htdocs/ \
&& apt-get remove -y python build-essential nodejs curl

RUN cp /app/dist/docker-nginx.conf /etc/nginx/conf.d/default.conf
RUN mv /app/dist/ /var/www/

CMD ["nginx", "-g", "daemon off;"]
# Listen on 8080
RUN sed -i "s/Listen 80/Listen 8080/g" /usr/local/apache2/conf/httpd.conf
EXPOSE 8080
11 changes: 11 additions & 0 deletions src/static/.htaccess
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>
2 changes: 1 addition & 1 deletion src/static/docker-nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ server {
location ~* \.(?:css|js)$ {
try_files $uri =404;
expires 1y;
access_log off;
add_header Cache-Control "public";
access_log off;
}

# Any route containing a file extension (e.g. /devicesfile.js)
Expand Down

0 comments on commit ef0f4b3

Please sign in to comment.