-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.ytbot
50 lines (39 loc) · 1.33 KB
/
Dockerfile.ytbot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FROM golang:1.21.6-bookworm AS builder
COPY / /src/ytbot
WORKDIR /src/ytbot/ytbot
RUN go mod tidy
RUN go build ./... && \
go install ./...
FROM debian:bookworm-20240110-slim
ARG S6_OVERLAY_VERSION=3.1.6.0
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -x && \
# Install required packages
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
KEPT_PACKAGES+=(ca-certificates) && \
KEPT_PACKAGES+=(net-tools) && \
KEPT_PACKAGES+=(procps) && \
KEPT_PACKAGES+=(xz-utils) && \
apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}" \
&& \
# Clean up
apt-get remove -y "${TEMP_PACKAGES[@]}" && \
apt-get autoremove -y && \
rm -rf /src/* /tmp/* /var/lib/apt/lists/*
COPY --from=builder /go/bin/ytbot /usr/local/bin/ytbot
COPY rootfs/ /
# Deploy s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
# Configure s6 overlay
ENV S6_LOGGING=0 \
S6_VERBOSITY=1
# Set s6 init as entrypoint
ENTRYPOINT [ "/init" ]