From 6c3c33d3ef1fa69f6b4a012b030dc124c5e8a5e0 Mon Sep 17 00:00:00 2001 From: "jason.zhu" Date: Mon, 8 Feb 2021 15:04:13 +1100 Subject: [PATCH] Fixed wrong dockerfile for nodejs and python --- nodejs/Dockerfile | 24 +++++++++++------------- python/Dockerfile | 29 ++++++++++++++++------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/nodejs/Dockerfile b/nodejs/Dockerfile index 1176a4d..4c539e4 100644 --- a/nodejs/Dockerfile +++ b/nodejs/Dockerfile @@ -1,18 +1,16 @@ -FROM golang:1.12.5-alpine3.9 as dev +FROM node:12.4.0-alpine as dev -# installing git -RUN apk update && apk upgrade && \ - apk add --no-cache git +RUN mkdir /work/ +WORKDIR /work/ + +COPY ./src/package.json /work/package.json +RUN npm install + +COPY ./src/ /work/ -RUN go get github.com/sirupsen/logrus -RUN go get github.com/buaazp/fasthttprouter -RUN go get github.com/valyala/fasthttp -WORKDIR /work -COPY ./src /work/ -RUN go build -o app ###########START NEW IMAGE################### -FROM alpine:3.9 as prod -COPY --from=dev /work/app / -CMD ./app +FROM dev as prod + +CMD node . diff --git a/python/Dockerfile b/python/Dockerfile index 9c5859d..4e84691 100644 --- a/python/Dockerfile +++ b/python/Dockerfile @@ -1,18 +1,21 @@ -FROM golang:1.12.5-alpine3.9 as dev +FROM python:3.7.3-alpine3.9 as dev -# installing git -RUN apk update && apk upgrade && \ - apk add --no-cache git +RUN mkdir /work/ +WORKDIR /work/ -RUN go get github.com/sirupsen/logrus -RUN go get github.com/buaazp/fasthttprouter -RUN go get github.com/valyala/fasthttp +COPY ./src/requirements.txt /work/requirements.txt +RUN pip install -r requirements.txt + +COPY ./src/ /work/ -WORKDIR /work -COPY ./src /work/ -RUN go build -o app ###########START NEW IMAGE################### -FROM alpine:3.9 as prod -COPY --from=dev /work/app / -CMD ./app \ No newline at end of file +FROM python:3.7.3-alpine3.9 as prod + +RUN mkdir /app/ +WORKDIR /app/ + +COPY --from=dev /work/ /app/ +RUN pip install -r requirements.txt +ENV FLASK_APP=server.py +CMD flask run -h 0.0.0 -p 5000