Skip to content

Commit 5964008

Browse files
committed
Add boilerplate for new functions
1 parent 9bfc713 commit 5964008

File tree

60 files changed

+1891
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1891
-8
lines changed

.github/workflows/container-images.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ jobs:
2121
strategy:
2222
matrix:
2323
image:
24+
- function-data-buffer
2425
- function-generic-noop
2526
- function-generic-sleep
27+
- function-media-encode
28+
- function-media-generate-testpattern
29+
- function-media-merge
30+
- function-media-metadata-technical
31+
- function-media-package-hls
32+
- function-script-lua
2633
- gateway-nbmp
2734
- workflow-manager
2835
- workflow-manager-helper

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,15 @@ clean: ## Cleanup build output
203203
.PHONY: image
204204
image: $(addprefix image-, $(IMAGES)) ## Build all container images
205205

206+
## image-function-data-buffer: ## Build data-buffer function container image
206207
## image-function-generic-noop: ## Build generic-noop function container image
207208
## image-function-generic-sleep: ## Build generic-sleep function container image
209+
## image-function-media-encode: ## Build media-encode function container image
210+
## image-function-media-generate-testpattern: ## Build media-generate-testpattern function container image
211+
## image-function-media-merge: ## Build media-merge function container image
212+
## image-function-media-metadata-technical: ## Build media-metadata-technical function container image
213+
## image-function-media-package-hls: ## Build media-package-hls function container image
214+
## image-function-script-lua: ## Build script-lua function container image
208215
## image-gateway-nbmp: ## Build NBMP gateway container image
209216
## image-workflow-manager: ## Build workflow manager container image
210217
## image-workflow-manager-helper: ## Build workflow manager helper container image
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
ARG GOVERSION
4+
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:${GOVERSION} AS build
5+
6+
ARG SKAFFOLD_GO_GCFLAGS=""
7+
8+
WORKDIR /app
9+
10+
COPY go.mod go.sum ./
11+
RUN --mount=type=cache,target=/root/.cache/go-build \
12+
go mod download
13+
COPY . .
14+
15+
# BUILD_DATE changes ofter so move this section down to allow for caching
16+
ARG TARGETOS \
17+
TARGETARCH \
18+
TARGETVARIANT \
19+
VERSION \
20+
GIT_COMMIT \
21+
GIT_TREE_STATE \
22+
BUILD_DATE
23+
24+
RUN --mount=type=cache,target=/root/.cache/go-build \
25+
--mount=type=cache,target=/go/pkg/mod \
26+
--mount=type=cache,target=/app/tmp,id=app-tmp-${TARGETARCH}-${TARGETVARIANT},sharing=locked \
27+
make build-task-shim \
28+
"OS=${TARGETOS}" \
29+
"ARCH=${TARGETARCH}" \
30+
"VERSION=${VERSION}" \
31+
"GIT_COMMIT=${GIT_COMMIT}" \
32+
"GIT_TREE_STATE=${GIT_TREE_STATE}" \
33+
"BUILD_DATE=${BUILD_DATE}" \
34+
&& make build-functions \
35+
"OS=${TARGETOS}" \
36+
"ARCH=${TARGETARCH}" \
37+
"VERSION=${VERSION}" \
38+
"GIT_COMMIT=${GIT_COMMIT}" \
39+
"GIT_TREE_STATE=${GIT_TREE_STATE}" \
40+
"BUILD_DATE=${BUILD_DATE}"
41+
42+
FROM gcr.io/distroless/static:latest
43+
LABEL org.opencontainers.image.base.name="gcr.io/distroless/static:latest"
44+
45+
ENV GOTRACEBACK=all
46+
47+
ARG TARGETOS \
48+
TARGETARCH \
49+
VERSION \
50+
GIT_COMMIT \
51+
BUILD_DATE
52+
53+
LABEL maintainer="Matthias Neugebauer <mtneug@shio.solutions>" \
54+
org.opencontainers.image.created="${BUILD_DATE}" \
55+
org.opencontainers.image.authors="Matthias Neugebauer <mtneug@shio.solutions>" \
56+
org.opencontainers.image.url="ghcr.io/nagare-media/engine/function-data-buffer" \
57+
org.opencontainers.image.documentation="https://nagare.media" \
58+
org.opencontainers.image.source="https://github.com/nagare-media/engine" \
59+
org.opencontainers.image.version="${VERSION}" \
60+
org.opencontainers.image.revision="${GIT_COMMIT}" \
61+
org.opencontainers.image.vendor="nagare media" \
62+
org.opencontainers.image.licenses="Apache-2.0" \
63+
org.opencontainers.image.title="nagare media engine" \
64+
org.opencontainers.image.description="nagare media engine — an open source modern cloud- and edge-native media workflow system running on Kubernetes"
65+
66+
WORKDIR /
67+
COPY --from=build "/app/bin/task-shim-${VERSION}-${TARGETOS}-${TARGETARCH}" /task-shim
68+
COPY --from=build "/app/bin/functions-${VERSION}-${TARGETOS}-${TARGETARCH}" /data-buffer
69+
USER 65532:65532
70+
71+
COPY <<EOF /config/task-shim.yaml
72+
apiVersion: engine.nagare.media/v1alpha1
73+
kind: TaskShimConfig
74+
task:
75+
actions:
76+
- name: write task description document
77+
action: task-shim.engine.nagare.media/file
78+
config: |
79+
path: /tmp/nbmp.tdd
80+
content: |
81+
{{ toJson .Task }}
82+
- name: execute function
83+
action: task-shim.engine.nagare.media/exec
84+
config:
85+
command: /data-buffer
86+
args: ["/tmp/nbmp.tdd"]
87+
EOF
88+
89+
# NBMP Task API
90+
EXPOSE 8888
91+
92+
ENTRYPOINT [ "/task-shim" ]
93+
CMD [ "--config", "/config/task-shim.yaml" ]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
ARG GOVERSION
4+
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:${GOVERSION} AS build
5+
6+
ARG SKAFFOLD_GO_GCFLAGS=""
7+
8+
WORKDIR /app
9+
10+
COPY go.mod go.sum ./
11+
RUN --mount=type=cache,target=/root/.cache/go-build \
12+
go mod download
13+
COPY . .
14+
15+
# BUILD_DATE changes ofter so move this section down to allow for caching
16+
ARG TARGETOS \
17+
TARGETARCH \
18+
TARGETVARIANT \
19+
VERSION \
20+
GIT_COMMIT \
21+
GIT_TREE_STATE \
22+
BUILD_DATE
23+
24+
RUN --mount=type=cache,target=/root/.cache/go-build \
25+
--mount=type=cache,target=/go/pkg/mod \
26+
--mount=type=cache,target=/app/tmp,id=app-tmp-${TARGETARCH}-${TARGETVARIANT},sharing=locked \
27+
make build-task-shim \
28+
"OS=${TARGETOS}" \
29+
"ARCH=${TARGETARCH}" \
30+
"VERSION=${VERSION}" \
31+
"GIT_COMMIT=${GIT_COMMIT}" \
32+
"GIT_TREE_STATE=${GIT_TREE_STATE}" \
33+
"BUILD_DATE=${BUILD_DATE}" \
34+
&& make build-functions \
35+
"OS=${TARGETOS}" \
36+
"ARCH=${TARGETARCH}" \
37+
"VERSION=${VERSION}" \
38+
"GIT_COMMIT=${GIT_COMMIT}" \
39+
"GIT_TREE_STATE=${GIT_TREE_STATE}" \
40+
"BUILD_DATE=${BUILD_DATE}"
41+
42+
FROM gcr.io/distroless/static:latest
43+
LABEL org.opencontainers.image.base.name="gcr.io/distroless/static:latest"
44+
45+
ENV GOTRACEBACK=all
46+
47+
ARG TARGETOS \
48+
TARGETARCH \
49+
VERSION \
50+
GIT_COMMIT \
51+
BUILD_DATE
52+
53+
LABEL maintainer="Matthias Neugebauer <mtneug@shio.solutions>" \
54+
org.opencontainers.image.created="${BUILD_DATE}" \
55+
org.opencontainers.image.authors="Matthias Neugebauer <mtneug@shio.solutions>" \
56+
org.opencontainers.image.url="ghcr.io/nagare-media/engine/function-media-encode" \
57+
org.opencontainers.image.documentation="https://nagare.media" \
58+
org.opencontainers.image.source="https://github.com/nagare-media/engine" \
59+
org.opencontainers.image.version="${VERSION}" \
60+
org.opencontainers.image.revision="${GIT_COMMIT}" \
61+
org.opencontainers.image.vendor="nagare media" \
62+
org.opencontainers.image.licenses="Apache-2.0" \
63+
org.opencontainers.image.title="nagare media engine" \
64+
org.opencontainers.image.description="nagare media engine — an open source modern cloud- and edge-native media workflow system running on Kubernetes"
65+
66+
WORKDIR /
67+
COPY --from=build "/app/bin/task-shim-${VERSION}-${TARGETOS}-${TARGETARCH}" /task-shim
68+
COPY --from=build "/app/bin/functions-${VERSION}-${TARGETOS}-${TARGETARCH}" /media-encode
69+
USER 65532:65532
70+
71+
COPY <<EOF /config/task-shim.yaml
72+
apiVersion: engine.nagare.media/v1alpha1
73+
kind: TaskShimConfig
74+
task:
75+
actions:
76+
- name: write task description document
77+
action: task-shim.engine.nagare.media/file
78+
config: |
79+
path: /tmp/nbmp.tdd
80+
content: |
81+
{{ toJson .Task }}
82+
- name: execute function
83+
action: task-shim.engine.nagare.media/exec
84+
config:
85+
command: /media-encode
86+
args: ["/tmp/nbmp.tdd"]
87+
EOF
88+
89+
# NBMP Task API
90+
EXPOSE 8888
91+
92+
ENTRYPOINT [ "/task-shim" ]
93+
CMD [ "--config", "/config/task-shim.yaml" ]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
ARG GOVERSION
4+
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:${GOVERSION} AS build
5+
6+
ARG SKAFFOLD_GO_GCFLAGS=""
7+
8+
WORKDIR /app
9+
10+
COPY go.mod go.sum ./
11+
RUN --mount=type=cache,target=/root/.cache/go-build \
12+
go mod download
13+
COPY . .
14+
15+
# BUILD_DATE changes ofter so move this section down to allow for caching
16+
ARG TARGETOS \
17+
TARGETARCH \
18+
TARGETVARIANT \
19+
VERSION \
20+
GIT_COMMIT \
21+
GIT_TREE_STATE \
22+
BUILD_DATE
23+
24+
RUN --mount=type=cache,target=/root/.cache/go-build \
25+
--mount=type=cache,target=/go/pkg/mod \
26+
--mount=type=cache,target=/app/tmp,id=app-tmp-${TARGETARCH}-${TARGETVARIANT},sharing=locked \
27+
make build-task-shim \
28+
"OS=${TARGETOS}" \
29+
"ARCH=${TARGETARCH}" \
30+
"VERSION=${VERSION}" \
31+
"GIT_COMMIT=${GIT_COMMIT}" \
32+
"GIT_TREE_STATE=${GIT_TREE_STATE}" \
33+
"BUILD_DATE=${BUILD_DATE}" \
34+
&& make build-functions \
35+
"OS=${TARGETOS}" \
36+
"ARCH=${TARGETARCH}" \
37+
"VERSION=${VERSION}" \
38+
"GIT_COMMIT=${GIT_COMMIT}" \
39+
"GIT_TREE_STATE=${GIT_TREE_STATE}" \
40+
"BUILD_DATE=${BUILD_DATE}"
41+
42+
FROM gcr.io/distroless/static:latest
43+
LABEL org.opencontainers.image.base.name="gcr.io/distroless/static:latest"
44+
45+
ENV GOTRACEBACK=all
46+
47+
ARG TARGETOS \
48+
TARGETARCH \
49+
VERSION \
50+
GIT_COMMIT \
51+
BUILD_DATE
52+
53+
LABEL maintainer="Matthias Neugebauer <mtneug@shio.solutions>" \
54+
org.opencontainers.image.created="${BUILD_DATE}" \
55+
org.opencontainers.image.authors="Matthias Neugebauer <mtneug@shio.solutions>" \
56+
org.opencontainers.image.url="ghcr.io/nagare-media/engine/function-media-generate-testpattern" \
57+
org.opencontainers.image.documentation="https://nagare.media" \
58+
org.opencontainers.image.source="https://github.com/nagare-media/engine" \
59+
org.opencontainers.image.version="${VERSION}" \
60+
org.opencontainers.image.revision="${GIT_COMMIT}" \
61+
org.opencontainers.image.vendor="nagare media" \
62+
org.opencontainers.image.licenses="Apache-2.0" \
63+
org.opencontainers.image.title="nagare media engine" \
64+
org.opencontainers.image.description="nagare media engine — an open source modern cloud- and edge-native media workflow system running on Kubernetes"
65+
66+
WORKDIR /
67+
COPY --from=build "/app/bin/task-shim-${VERSION}-${TARGETOS}-${TARGETARCH}" /task-shim
68+
COPY --from=build "/app/bin/functions-${VERSION}-${TARGETOS}-${TARGETARCH}" /media-generate-testpattern
69+
USER 65532:65532
70+
71+
COPY <<EOF /config/task-shim.yaml
72+
apiVersion: engine.nagare.media/v1alpha1
73+
kind: TaskShimConfig
74+
task:
75+
actions:
76+
- name: write task description document
77+
action: task-shim.engine.nagare.media/file
78+
config: |
79+
path: /tmp/nbmp.tdd
80+
content: |
81+
{{ toJson .Task }}
82+
- name: execute function
83+
action: task-shim.engine.nagare.media/exec
84+
config:
85+
command: /media-generate-testpattern
86+
args: ["/tmp/nbmp.tdd"]
87+
EOF
88+
89+
# NBMP Task API
90+
EXPOSE 8888
91+
92+
ENTRYPOINT [ "/task-shim" ]
93+
CMD [ "--config", "/config/task-shim.yaml" ]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.generic.generic

0 commit comments

Comments
 (0)