forked from giongto35/cloud-game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (53 loc) · 1.35 KB
/
Dockerfile
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
51
52
53
54
55
56
57
58
59
60
61
62
# The base cloud-game image
ARG BUILD_PATH=/go/src/github.com/giongto35/cloud-game
# build image
FROM debian:bullseye-slim AS build
ARG BUILD_PATH
WORKDIR ${BUILD_PATH}
# system libs layer
RUN apt-get -qq update && apt-get -qq install --no-install-recommends -y \
gcc \
ca-certificates \
libopus-dev \
libsdl2-dev \
libvpx-dev \
libx264-dev \
make \
pkg-config \
wget \
&& rm -rf /var/lib/apt/lists/*
# go setup layer
ARG GO=go1.18.linux-amd64.tar.gz
RUN wget -q https://golang.org/dl/$GO \
&& rm -rf /usr/local/go \
&& tar -C /usr/local -xzf $GO \
&& rm $GO
ENV PATH="${PATH}:/usr/local/go/bin"
# go deps layer
COPY go.mod go.sum ./
RUN go mod download
# app build layer
COPY pkg ./pkg
COPY cmd ./cmd
COPY Makefile .
COPY scripts/version.sh scripts/version.sh
ARG VERSION
RUN GIT_VERSION=${VERSION} make build
# base image
FROM debian:bullseye-slim
ARG BUILD_PATH
WORKDIR /usr/local/share/cloud-game
COPY scripts/install.sh install.sh
RUN bash install.sh && \
rm -rf /var/lib/apt/lists/* install.sh
COPY --from=build ${BUILD_PATH}/bin/ ./
RUN cp -s $(pwd)/* /usr/local/bin
COPY assets/cores ./assets/cores
COPY assets/games ./assets/games
COPY configs ./configs
COPY web ./web
ARG VERSION
COPY scripts/version.sh version.sh
RUN bash ./version.sh ./web/index.html ${VERSION} && \
rm -rf version.sh
EXPOSE 8000 9000