Skip to content
Snippets Groups Projects
Commit c3cc2fa9 authored by Pierre Michiels's avatar Pierre Michiels
Browse files

08.11.20 15:57

parent be35f701
Branches
No related tags found
No related merge requests found
FROM python:3 FROM golang:alpine AS builder
ADD server.py / COPY main.go /app/
CMD ["python3","./server.py"] WORKDIR /app
RUN CGO_ENABLED=0 go build -ldflags="-w -s" main.go
FROM scratch AS runner
COPY --from=builder /app/main /app/main
ENTRYPOINT ["/app/main"]
\ No newline at end of file
# FROM python:3.7-alpine AS builder
# COPY server.py /app/
# WORKDIR /app
# CMD ["python3","./server.py"]
# FROM python:3.7-alpine as builder
# COPY server.py /compiled/
# WORKDIR /compiled
# RUN python3 -m compileall server.py
# RUN mkdir /install
# WORKDIR /install
# COPY requirements.txt /requirements.txt
# RUN pip install --install-option="--prefix=/install" -r /requirements.txt
# FROM builder
# COPY --from=builder /install /usr/local
# RUN mkdir app
# COPY server.py /app
# WORKDIR /app
# CMD ["gunicorn", "-w 4", "server:app"]
# FROM scratch AS runner
# ENTRYPOINT ["/app"]
# FROM scratch AS runner
# #COPY --from=builder /compiled/__pycache__ /runnable/
# RUN mkdir /run
# COPY server.py /run/
# CMD ["sh", "/run/server.py"]
#CMD ["/runnable/server.cpython-38.pyc"]
# FROM python:3.7-alpine as base
# FROM base as builder
# RUN mkdir /install
# WORKDIR /install
# COPY requirements.txt /requirements.txt
# RUN pip install --install-option="--prefix=/install" -r /requirements.txt
# FROM base
# COPY --from=builder /install /usr/local
# COPY server.py /app
# WORKDIR /app
# CMD ["gunicorn", "-w 4", "main:app"]
# Version fonctionnelle avec donnant une image de 41MB
FROM python:3.7-alpine AS builder
COPY server.py /app/
WORKDIR /app
CMD ["python3","./server.py"]
\ No newline at end of file
package main
import(
"fmt"
"net/http"
"os"
)
func main(){
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){
r.Header.Set("Content-type", "text/html")
fmt.Fprintf(w, "<h1>Hello hostname: %s</h1>", os.Getenv("HOSTNAME"))
})
http.ListenAndServe(":80", nil)
}
\ No newline at end of file
gunicorn>=19,<20
\ No newline at end of file
import http.server import http.server
import socketserver import socketserver
import os import os
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment