Browse Source

update deps, add tini and curl, use COPY not ADD

Bret Fisher 4 years ago
parent
commit
69c11f95a3
2 changed files with 22 additions and 4 deletions
  1. 13 1
      result/Dockerfile
  2. 9 3
      vote/Dockerfile

+ 13 - 1
result/Dockerfile

@@ -1,7 +1,19 @@
 FROM node:10-slim
 
+# add curl for healthcheck
+RUN apt-get update \
+    && apt-get install -y --no-install-recommends \
+    curl \
+    && rm -rf /var/lib/apt/lists/*
+
+# Add Tini for proper init of signals
+ENV TINI_VERSION v0.19.0
+ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
+RUN chmod +x /tini
+
 WORKDIR /app
 
+# have nodemon available for local dev use (file watching)
 RUN npm install -g nodemon
 
 COPY package*.json ./
@@ -16,4 +28,4 @@ ENV PORT 80
 
 EXPOSE 80
 
-CMD ["node", "server.js"]
+CMD ["/tini", "--", "node", "server.js"]

+ 9 - 3
vote/Dockerfile

@@ -1,15 +1,21 @@
 # Using official python runtime base image
-FROM python:2.7-alpine
+FROM python:3.9-slim
+
+# add curl for healthcheck
+RUN apt-get update \
+    && apt-get install -y --no-install-recommends \
+    curl \
+    && rm -rf /var/lib/apt/lists/*
 
 # Set the application directory
 WORKDIR /app
 
 # Install our requirements.txt
-ADD requirements.txt /app/requirements.txt
+COPY requirements.txt /app/requirements.txt
 RUN pip install -r requirements.txt
 
 # Copy our code from the current folder to /app inside the container
-ADD . /app
+COPY . .
 
 # Make port 80 available for links and/or publish
 EXPOSE 80