Modified Dockerfiles for different project as multistage containers
parent
7f663d61fb
commit
939816c343
|
@ -1 +1,21 @@
|
|||
FROM mcr.microsoft.com/dotnet/sdk:2.1-focal
|
||||
FROM mcr.microsoft.com/dotnet/sdk:2.1-focal as dev
|
||||
|
||||
RUN mkdir /app/
|
||||
WORKDIR /app/
|
||||
|
||||
COPY ./src/work.csproj /app/work.csproj
|
||||
RUN dotnet restore
|
||||
|
||||
COPY ./src/ /app/
|
||||
RUN mkdir /out/
|
||||
RUN dotnet publish --no-restore --output /out/ --configuration Release
|
||||
|
||||
################# PRODUCTION IMAGE #################
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim as prod
|
||||
|
||||
RUN mkdir /app/
|
||||
WORKDIR /app/
|
||||
COPY --from=dev /out/ /app/
|
||||
RUN chmod +x /app/
|
||||
CMD dotnet work.dll
|
|
@ -1,4 +1,4 @@
|
|||
FROM golang:1.12.5-alpine3.9 as builder
|
||||
FROM golang:1.12.5-alpine3.9 as dev
|
||||
|
||||
# installing git
|
||||
RUN apk update && apk upgrade && \
|
||||
|
@ -6,4 +6,13 @@ RUN apk update && apk upgrade && \
|
|||
|
||||
RUN go get github.com/sirupsen/logrus
|
||||
RUN go get github.com/buaazp/fasthttprouter
|
||||
RUN go get github.com/valyala/fasthttp
|
||||
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
|
||||
|
|
|
@ -1 +1,18 @@
|
|||
FROM node:12.4.0-alpine
|
||||
FROM golang:1.12.5-alpine3.9 as dev
|
||||
|
||||
# installing git
|
||||
RUN apk update && apk upgrade && \
|
||||
apk add --no-cache git
|
||||
|
||||
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
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
FROM python:3.7.3-alpine3.9
|
||||
FROM golang:1.12.5-alpine3.9 as dev
|
||||
|
||||
RUN pip install flask
|
||||
# installing git
|
||||
RUN apk update && apk upgrade && \
|
||||
apk add --no-cache git
|
||||
|
||||
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
|
|
@ -0,0 +1 @@
|
|||
Flask == 1.0.3
|
Loading…
Reference in New Issue