part 3 code

This commit is contained in:
Marcel Dempers 2019-06-30 19:33:44 +10:00
parent f06b5886e7
commit 0147ab746f
9 changed files with 104 additions and 30 deletions

View File

@ -1 +1,22 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch as dev
RUN mkdir /work/
WORKDIR /work/
COPY ./src/work.csproj /work/work.csproj
RUN dotnet restore
COPY ./src/ /work/
RUN mkdir /out/
RUN dotnet publish --no-restore --output /out/ --configuration Release
###########START NEW IMAGE###########################################
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim as prod
RUN mkdir /app/
WORKDIR /app/
COPY --from=dev /out/ /app/
RUN chmod +x /app/
CMD dotnet work.dll

View File

@ -3,8 +3,8 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:20571",
"sslPort": 44382
"applicationUrl": "http://localhost:63846",
"sslPort": 44303
}
},
"profiles": {

View File

@ -3,9 +3,11 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />

View File

@ -1,25 +1,29 @@
version: "3"
version: "3.4"
services:
csharp: #docker run -it -v ${PWD}:/work -w /work -p 5000:5000 aimvector/csharp:1.0.0 /bin/sh
container_name: csharp
image: aimvector/csharp:1.0.0
build: ./c#
working_dir: /work
entrypoint: /bin/sh
stdin_open: true
tty: true
build:
context: ./c#
target: prod
#working_dir: /work #comment out for build.target:prod
#entrypoint: /bin/sh #comment out for build.target:prod
#stdin_open: true #comment out for build.target:prod
#tty: true #comment out for build.target:prod
volumes:
- ./c#/src/:/work
- ./c#/src/:/work/
ports:
- 5000:5000
golang: #docker run -it -v ${PWD}:/work -w /work -p 5001:5000 aimvector/golang:1.0.0 /bin/sh
container_name: golang
image: aimvector/golang:1.0.0
build: ./golang
working_dir: /work
entrypoint: /bin/sh
stdin_open: true
tty: true
build:
context: ./golang
target: prod
#working_dir: /work #comment out for build.target:prod
#entrypoint: /bin/sh #comment out for build.target:prod
#stdin_open: true #comment out for build.target:prod
#tty: true #comment out for build.target:prod
volumes:
- ./golang/src/:/work
ports:
@ -27,11 +31,13 @@ services:
nodejs: #docker run -it -v ${PWD}:/work -w /work -p 5002:5000 aimvector/nodejs:1.0.0 /bin/sh
container_name: nodejs
image: aimvector/nodejs:1.0.0
build: ./nodejs
working_dir: /work
entrypoint: /bin/sh
stdin_open: true
tty: true
build:
context: ./nodejs
target: prod
#working_dir: /work #comment out for build.target:prod
#entrypoint: /bin/sh #comment out for build.target:prod
#stdin_open: true #comment out for build.target:prod
#tty: true #comment out for build.target:prod
volumes:
- ./nodejs/src/:/work
ports:
@ -39,11 +45,13 @@ services:
python: #docker run -it -v ${PWD}:/work -w /work -p 5003:5000 aimvector/python:1.0.0 /bin/sh
container_name: python
image: aimvector/python:1.0.0
build: ./python
working_dir: /work
entrypoint: /bin/sh
stdin_open: true
tty: true
build:
context: ./python
target: prod
#working_dir: /work #comment out for build.target:prod
#entrypoint: /bin/sh #comment out for build.target:prod
#stdin_open: true #comment out for build.target:prod
#tty: true #comment out for build.target:prod
volumes:
- ./python/src/:/work
ports:

View File

@ -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 && \
@ -7,3 +7,12 @@ 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
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

Binary file not shown.

View File

@ -1 +1,16 @@
FROM node:12.4.0-alpine
FROM node:12.4.0-alpine as dev
RUN mkdir /work/
WORKDIR /work/
COPY ./src/package.json /work/package.json
RUN npm install
COPY ./src/ /work/
###########START NEW IMAGE###################
FROM dev as prod
CMD node .

View File

@ -1,3 +1,21 @@
FROM python:3.7.3-alpine3.9
FROM python:3.7.3-alpine3.9 as dev
RUN pip install flask
RUN mkdir /work/
WORKDIR /work/
COPY ./src/requirements.txt /work/requirements.txt
RUN pip install -r requirements.txt
COPY ./src/ /work/
###########START NEW IMAGE###################
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

View File

@ -0,0 +1 @@
Flask == 1.0.3