Skip to content

Commit

Permalink
Create dockerfile to run tests in different flavours of linux to veri…
Browse files Browse the repository at this point in the history
…fy behaviour.
  • Loading branch information
Kilemonn committed Jul 10, 2024
1 parent b5965fa commit abf65e8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Environment-Test-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM alpine:3.20.0 AS alpine

WORKDIR /alpine

RUN apk update && apk upgrade && apk add g++ cmake make git bluez-dev glib-dev bluez

COPY ./src ./src
COPY ./tests ./tests
COPY ./CMakeLists.txt ./CMakeLists.txt

RUN ["cmake", "-B", "build", "."]

WORKDIR /alpine/build
RUN ["make", "all"]

WORKDIR /alpine/build/tests
RUN ["./CppSocketLibraryTests"]

FROM ubuntu:24.10 AS ubuntu

WORKDIR /ubuntu

RUN apt update && apt upgrade -y && apt install g++ make cmake git libbluetooth-dev libglib2.0-dev bluez -y

COPY ./src ./src
COPY ./tests ./tests
COPY ./CMakeLists.txt ./CMakeLists.txt

# Do a fake copy to make sure it runs both stages
COPY --from=alpine /alpine/build/test/CppSocketLibraryTests /ubuntu/CppSocketLibraryTests

RUN ["cmake", "-B", "build", "."]

WORKDIR /ubuntu/build
RUN ["make", "all"]

WORKDIR /ubuntu/build/tests
RUN ["./CppSocketLibraryTests"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,9 @@ signal(SIGPIPE, SIG_IGN);
### NOTE: UDP Read Sizes
- Take care when reading UDP messages. If you do not read the entire length of the message the rest of the data will be lost.
## Running the tests Dockerfile
The dockerfile is aimed at testing the socket behaviour across a few different flavours of linux to check it is functioning correctly. Especially since development is being done on WSL and there could be some slight differences.
`docker build -f Environment-Test-Dockerfile .`

0 comments on commit abf65e8

Please sign in to comment.