Skip to content

Commit 4b26645

Browse files
committed
Add Dockerfile
This adds a Dockerfile and build instructions. The container image uses Caddy (https://caddyserver.com/) as static binary web server in a `scratch` image.
1 parent 59e0bbb commit 4b26645

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.dockerignore
2+
.git/
3+
.github/
4+
build/
5+
Dockerfile
6+
node_modules/

Dockerfile

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
ARG NODE_VERSION=16
4+
FROM node:${NODE_VERSION}-alpine as build
5+
6+
RUN apk add --no-cache git
7+
WORKDIR /src
8+
COPY package.json .
9+
COPY package-lock.json .
10+
RUN npm i
11+
COPY / .
12+
13+
ARG PUBLIC_URL=/
14+
ARG REACT_APP_SETTINGS_PATH=/editor-settings.toml
15+
RUN npm run build
16+
17+
18+
ARG NODE_VERSION=16
19+
FROM node:${NODE_VERSION}-alpine as caddy
20+
21+
RUN apk add --no-cache curl
22+
23+
ARG CADDY_VERSION=2.5.1
24+
25+
RUN curl -sSL "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz" | tar xzf - caddy \
26+
&& chown 0:0 caddy \
27+
&& chmod +x caddy
28+
RUN mkdir -p /rootfs/config /rootfs/data \
29+
&& chown 1000:1000 /rootfs/config /rootfs/data
30+
31+
32+
FROM scratch
33+
34+
ENV XDG_CONFIG_HOME /config
35+
ENV XDG_DATA_HOME /data
36+
37+
COPY <<EOF /Caddyfile
38+
{
39+
admin off
40+
}
41+
42+
:80 {
43+
root * /www
44+
file_server
45+
}
46+
47+
:2019 {
48+
metrics /metrics
49+
respond /healthz 200
50+
}
51+
EOF
52+
53+
COPY <<EOF /etc/nsswitch.conf
54+
hosts: files dns
55+
EOF
56+
57+
COPY --from=caddy /rootfs /
58+
COPY --from=caddy /caddy /
59+
COPY --from=build /src/build /www
60+
61+
USER 1000:1000
62+
63+
EXPOSE 80
64+
EXPOSE 443
65+
EXPOSE 2019
66+
67+
LABEL org.opencontainers.image.title "Opencast Video Editor"
68+
LABEL org.opencontainers.image.description "Web-based video editor for Opencast"
69+
LABEL org.opencontainers.image.vendor "Opencast"
70+
LABEL org.opencontainers.image.licenses "Apache-2.0"
71+
LABEL org.opencontainers.image.url "https://github.com/opencast/opencast-editor"
72+
LABEL org.opencontainers.image.documentation "https://github.com/opencast/opencast-editor"
73+
LABEL org.opencontainers.image.source "https://github.com/opencast/opencast-editor"
74+
75+
ENTRYPOINT [ "/caddy" ]
76+
CMD ["run", "--config", "/Caddyfile", "--adapter", "caddyfile"]

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ To make the editor work in a sub-path, use:
3636

3737
PUBLIC_URL=/path npm run build
3838

39+
To build a container image, run:
40+
41+
DOCKER_BUILDKIT=1 docker build \
42+
--build-arg NODE_VERSION=16 \
43+
--build-arg CADDY_VERSION=2.5.1 \
44+
--build-arg PUBLIC_URL=/ \
45+
--build-arg REACT_APP_SETTINGS_PATH=/editor-settings.toml \
46+
-t quay.io/opencast/editor .
3947

4048
Configuration
4149
-------------

0 commit comments

Comments
 (0)