adding in improvements from when we ran the birthday party app. Mostly fixed the Dockerfiles so they use Alpine for the base images. That required re-working the Java worker Docker file. Removed links from compose file. cleaned up a few things like a tab instead of a space in app.py
This commit is contained in:
parent
10a3a3b68a
commit
261eb03102
@ -7,8 +7,6 @@ services:
|
|||||||
- ./voting-app:/app
|
- ./voting-app:/app
|
||||||
ports:
|
ports:
|
||||||
- "5000:80"
|
- "5000:80"
|
||||||
links:
|
|
||||||
- redis
|
|
||||||
networks:
|
networks:
|
||||||
- front-tier
|
- front-tier
|
||||||
- back-tier
|
- back-tier
|
||||||
@ -19,28 +17,25 @@ services:
|
|||||||
- ./result-app:/app
|
- ./result-app:/app
|
||||||
ports:
|
ports:
|
||||||
- "5001:80"
|
- "5001:80"
|
||||||
links:
|
|
||||||
- db
|
|
||||||
networks:
|
networks:
|
||||||
- front-tier
|
- front-tier
|
||||||
- back-tier
|
- back-tier
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
build: ./worker
|
build: ./worker
|
||||||
links:
|
|
||||||
- db
|
|
||||||
- redis
|
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis:alpine
|
||||||
|
container_name: redis
|
||||||
ports: ["6379"]
|
ports: ["6379"]
|
||||||
networks:
|
networks:
|
||||||
- back-tier
|
- back-tier
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:9.4
|
image: postgres:9.4
|
||||||
|
container_name: db
|
||||||
volumes:
|
volumes:
|
||||||
- "db-data:/var/lib/postgresql/data"
|
- "db-data:/var/lib/postgresql/data"
|
||||||
networks:
|
networks:
|
||||||
@ -52,5 +47,3 @@ volumes:
|
|||||||
networks:
|
networks:
|
||||||
front-tier:
|
front-tier:
|
||||||
back-tier:
|
back-tier:
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
FROM node:0.10
|
FROM mhart/alpine-node
|
||||||
|
|
||||||
RUN mkdir /app
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ADD package.json /app/package.json
|
ADD package.json /app/package.json
|
||||||
|
RUN npm config set registry http://registry.npmjs.org
|
||||||
RUN npm install && npm ls
|
RUN npm install && npm ls
|
||||||
RUN mv /app/node_modules /node_modules
|
RUN mv /app/node_modules /node_modules
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<base href="/index.html">
|
<base href="/index.html">
|
||||||
<meta name = "viewport" content = "width=device-width, initial-scale = 1.0">
|
<meta name = "viewport" content = "width=device-width, initial-scale = 1.0">
|
||||||
<meta name="keywords" content="docker-compose, docker, stack">
|
<meta name="keywords" content="docker-compose, docker, stack">
|
||||||
<meta name="author" content="Tutum dev team">
|
<meta name="author" content="Docker">
|
||||||
<link rel='stylesheet' href='/stylesheets/style.css' />
|
<link rel='stylesheet' href='/stylesheets/style.css' />
|
||||||
</head>
|
</head>
|
||||||
<body ng-controller="statsCtrl" >
|
<body ng-controller="statsCtrl" >
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Using official python runtime base image
|
# Using official python runtime base image
|
||||||
FROM python:2.7
|
FROM python:2.7-alpine
|
||||||
|
|
||||||
# Set the application directory
|
# Set the application directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -11,7 +11,7 @@ RUN pip install -r requirements.txt
|
|||||||
# Copy our code from the current folder to /app inside the container
|
# Copy our code from the current folder to /app inside the container
|
||||||
ADD . /app
|
ADD . /app
|
||||||
|
|
||||||
# Make port 5000 available for links and/or publish
|
# Make port 80 available for links and/or publish
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
# Define our command to be run when launching the container
|
# Define our command to be run when launching the container
|
||||||
|
@ -36,9 +36,10 @@ def hello():
|
|||||||
hostname=hostname,
|
hostname=hostname,
|
||||||
vote=vote,
|
vote=vote,
|
||||||
))
|
))
|
||||||
|
resp.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0';
|
||||||
resp.set_cookie('voter_id', voter_id)
|
resp.set_cookie('voter_id', voter_id)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host='0.0.0.0', port=80, debug=True)
|
app.run(host='0.0.0.0', port=80, debug=True)
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
FROM java:7
|
FROM java:openjdk-8-jdk-alpine
|
||||||
|
|
||||||
RUN apt-get update -qq && apt-get install -y maven && apt-get clean
|
RUN MAVEN_VERSION=3.3.3 \
|
||||||
|
&& cd /usr/share \
|
||||||
|
&& wget http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz -O - | tar xzf - \
|
||||||
|
&& mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \
|
||||||
|
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
|
||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
@ -12,4 +16,4 @@ RUN ["mvn", "verify"]
|
|||||||
ADD src /code/src
|
ADD src /code/src
|
||||||
RUN ["mvn", "package"]
|
RUN ["mvn", "package"]
|
||||||
|
|
||||||
CMD ["/usr/lib/jvm/java-7-openjdk-amd64/bin/java", "-jar", "target/worker-jar-with-dependencies.jar"]
|
CMD ["java", "-jar", "target/worker-jar-with-dependencies.jar"]
|
||||||
|
Loading…
Reference in New Issue
Block a user