MVP test suite
This commit is contained in:
parent
2b2ec9f7f7
commit
1f44df6c32
6
Makefile
6
Makefile
|
@ -35,3 +35,9 @@ out/go.oci.tgz: \
|
|||
out/bash.oci.tgz \
|
||||
out/musl.oci.tgz
|
||||
docker build -t ocirep/go --output type=oci,dest=$@ packages/go
|
||||
|
||||
test:
|
||||
docker build -t ocirep/go_hello examples/go_hello
|
||||
@printf "\nOcirep Test Suite\n"
|
||||
@printf "go_hello -> "
|
||||
@docker run -i ocirep/go_hello | grep Success
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
FROM ocirep/busybox as build
|
||||
COPY --from=ocirep/go . /
|
||||
COPY . .
|
||||
RUN \
|
||||
go build main.go \
|
||||
&& mkdir -p $HOME/rootfs/etc \
|
||||
&& echo "nogroup:*:100:nobody" > ~/rootfs/etc/group \
|
||||
&& echo "nobody:*:100:100:::" > ~/rootfs/etc/passwd \
|
||||
&& cp main $HOME/rootfs/
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build --chown=100:100 /home/user/rootfs /
|
||||
USER 100:100
|
||||
ENTRYPOINT ["/main"]
|
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Success")
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
ARG GO_IMAGE=ocirep:go
|
||||
FROM ${GO_IMAGE} as build
|
||||
COPY . .
|
||||
RUN \
|
||||
go build main.go \
|
||||
&& mkdir -p rootfs/etc \
|
||||
&& echo "nogroup:*:100:nobody" > ~/rootfs/etc/group \
|
||||
&& echo "nobody:*:100:100:::" > ~/rootfs/etc/passwd \
|
||||
&& cp main rootfs/
|
||||
|
||||
ARG CA_IMAGE=ocirep:ca-certificates
|
||||
FROM scratch
|
||||
COPY --from=${CA_IMAGE} /
|
||||
COPY --from=build --chown=100:100 rootfs /
|
||||
USER 100:100
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT main
|
|
@ -1,15 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", HelloServer)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
|
||||
func HelloServer(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
|
||||
}
|
Reference in New Issue