Skip to content

Commit

Permalink
build: add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir committed Sep 26, 2020
1 parent e056ebb commit eda7c7a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ project (wavplayeralsa)
set (CMAKE_CXX_STANDARD 14)
include_directories(src)

find_package(Boost 1.65.1 REQUIRED COMPONENTS system filesystem)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()

# include third party header only libraries
include_directories(thirdparty)
include_directories(thirdparty/mqtt_cpp)
Expand All @@ -22,4 +27,4 @@ set (SOURCES
set(CMAKE_BUILD_TYPE Debug)

add_executable (wavplayeralsa ${SOURCES})
target_link_libraries(wavplayeralsa -lasound -lsndfile -lboost_system -lboost_filesystem -pthread -luuid)
target_link_libraries(wavplayeralsa -lasound -lsndfile ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} -pthread -luuid)
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

FROM ubuntu:18.04 AS build

# RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories

ARG DEBIAN_FRONTEND="noninteractive"

RUN apt-get update && \
apt-get -y install \
tzdata \
build-essential \
cmake \
uuid-dev \
libsndfile1-dev \
libasound2-dev \
libboost-all-dev

COPY ./src /src/src
COPY ./thirdparty /src/thirdparty
COPY ./CMakeLists.txt /src

RUN cd /src && \
cmake . && make


FROM ubuntu:18.04

WORKDIR /opt/wavplayeralsa

COPY --from=build /src/wavplayeralsa ./

RUN apt-get update && \
apt-get install -y \
libsndfile1 \
libasound2 \
libboost-system-dev \
libboost-filesystem-dev

CMD ["./wavplayeralsa", "-d", "/wav_files", "--http_listen_port", "80"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,10 @@ When a stop is performed via control interface, or when audio reach end of file:
Client can calculate the file's audio position at any givin time, using it's local clock, which should be synchronized to the player's clock.
This enable clients to act upon precise and continuous audio position, which does not dependent on network latency and update rate.
Any offset in clock synchronization (between client's and player's os) will be carried to audio position calculation, thus user should assure such offset is minimal (using NTP for example, or running client on same machine as player).

## Docker
You can run the player as a docker.

Build: `docker build .`

Run: `docker run -p 8080:80 -v ${MusicDirectory}:/wav_files --device /dev/snd ${DockerId}`

0 comments on commit eda7c7a

Please sign in to comment.