File tree Expand file tree Collapse file tree 2 files changed +31
-19
lines changed
Expand file tree Collapse file tree 2 files changed +31
-19
lines changed Original file line number Diff line number Diff line change 1- FROM golang:1.17-bullseye
2-
3- WORKDIR /app
4-
51#
6- # install dependencies
7- ENV DEBIAN_FRONTEND=noninteractive
8- RUN set -eux; apt update; \
9- apt install -y --no-install-recommends ffmpeg; \
10- #
11- # clean up
12- apt clean -y; \
13- rm -rf /var/lib/apt/lists/* /var/cache/apt/*
2+ # STAGE 1: build executable binary
3+ #
4+ FROM golang:1.17-alpine as builder
5+ WORKDIR /app
146
157#
168# build server
179COPY . .
18-
1910RUN go get -v -t -d .; \
20- go build -o bin/go-transcode
11+ CGO_ENABLED=0 go build -o go-transcode
12+
13+ #
14+ # STAGE 2: build a small image
15+ #
16+ FROM alpine
17+ WORKDIR /app
18+
19+ #
20+ # install dependencies
21+ RUN apk add --no-cache bash ffmpeg
22+
23+ COPY --from=builder /app/go-transcode go-transcode
24+ COPY profiles profiles
2125
26+ EXPOSE 8080
2227ENV TRANSCODE_BIND=:8080
2328
24- ENTRYPOINT [ "bin /go-transcode" ]
29+ ENTRYPOINT [ ". /go-transcode" ]
2530CMD [ "serve" ]
Original file line number Diff line number Diff line change 11ARG GO_TRANSCODE_IMAGE=go-transcode:latest
22ARG BASE_IMAGE=willprice/nvidia-ffmpeg
33
4+ #
5+ # STAGE 1: build executable binary
6+ #
47FROM $GO_TRANSCODE_IMAGE as build
5- FROM $BASE_IMAGE as base
68
9+ #
10+ # STAGE 2: build a small image
11+ #
12+ FROM $BASE_IMAGE as base
713WORKDIR /app
814
915ARG USERNAME=user
@@ -13,13 +19,14 @@ ARG USER_GID=$USER_UID
1319RUN groupadd --gid $USER_GID $USERNAME; \
1420 useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME;
1521
16- COPY --from=build /app/bin bin
22+ COPY --from=build /app/go-transcode go-transcode
1723COPY profiles profiles
18- COPY data data
1924
2025ENV USER=$USERNAME
2126ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
2227
28+ EXPOSE 8080
2329ENV TRANSCODE_BIND=:8080
24- ENTRYPOINT [ "bin/transcode" ]
30+
31+ ENTRYPOINT [ "./go-transcode" ]
2532CMD [ "serve" ]
You can’t perform that action at this time.
0 commit comments