FROM httpd:2.4
COPY ./index.html /usr/local/apache2/htdocs/index.html
COPY ./bakcground.jpg /usr/local/apache2/htdocs/bakcground.jpg
COPY ./wordart.png /usr/local/apache2/htdocs/wordart.png
FROM httpd:2.4
COPY ./* /usr/local/apache2/htdocs/
module helloapp
go 1.15
package main
import (
"fmt"
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Cześć");
}
func main() {
http.HandleFunc("/",handler)
fmt.Println("server started")
log.Fatal(http.ListenAndServe(":8090", nil))
}
FROM golang:latest
#ustawia pracujący folder
WORKDIR /helloApp
#kopiuje to pliki na kontener
ADD . .
#budujemy aplikacje
RUN go build -o main .
EXPOSE 8090
CMD ["/helloApp/main"]
FROM golang:1.13-alpine AS build
#ustawia pracujący folder
WORKDIR /src
COPY main*.go go.* ./
#budujemy aplikacje
RUN CGO_ENABLED=0 go build -o /bin/example2_2
FROM scratch
COPY --from=build /bin/example2_2 /bin/example2_2
EXPOSE 8090
CMD ["/bin/example2_2"]
class Program
{
static async Task Main(string[] args)
{
var counter = 0;
var max = args.Length != 0
? Convert.ToInt32(args[0]) : -1;
while (max == -1 || counter < max)
{
Console.WriteLine($"Counter: {++counter}");
await Task.Delay(1000);
}
}
}
FROM mcr.microsoft.com/dotnet/aspnet:3.1
COPY bin/Release/netcoreapp3.1/publish/ App/
WORKDIR /App
ENTRYPOINT ["dotnet", "NetCore.DockerTest.dll"]
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore
# copy everything else and build app
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app --no-restore
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /app ./
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY complexapp/*.csproj complexapp/
COPY libfoo/*.csproj libfoo/
COPY libbar/*.csproj libbar/
RUN dotnet restore complexapp/complexapp.csproj
# copy and build app and libraries
COPY complexapp/ complexapp/
COPY libfoo/ libfoo/
COPY libbar/ libbar/
WORKDIR /source/complexapp
RUN dotnet build -c release --no-restore
# test stage -- exposes optional entrypoint
# target entrypoint with: docker build --target test
FROM build AS test
WORKDIR /source/tests
COPY tests/ .
ENTRYPOINT ["dotnet", "test", "--logger:trx"]
FROM build AS publish
RUN dotnet publish -c release --no-build -o /app
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:5.0
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "complexapp.dll"]
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
package com.example.demo;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Pozdrowienia z Spring Boot!";
}
}
#pierwszy etap budowania aplikacji użyje obrazu rodzica maven 3.6.1
FROM maven:3.6.1-jdk-8-alpine AS MAVEN_BUILD
# kopiowanie pom i src do kontenera
COPY ./ ./
# pakowanie kodu naszej aplikacji
RUN mvn clean package
#drugi etap budowania aplikacji używając jdk 8 na alpine 3.9
FROM openjdk:8-jre-alpine3.9
# skopiuj tylko to co potrzebujemy z pierwszego etapu, a wszystko inne odrzuć
COPY --from=MAVEN_BUILD /target/demo-0.0.1-SNAPSHOT.jar /demo.jar
# ustaw polecenie startowe aby uruchomić JAR
CMD ["java", "-jar", "/demo.jar"]
FROM python:3
ADD my_script.py /
RUN pip install pystrich
CMD [ "python", "./my_script.py" ]
from pystrich.datamatrix import DataMatrixEncoder
encoder = DataMatrixEncoder('This is a DataMatrix.')
encoder.save('./datamatrix_test.png')
print(encoder.get_ascii())