-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented Docker and Docker Compose support #63
Changes from all commits
9e73045
1aab3e9
0775603
07973ff
64195b9
006415f
d50609d
8a5ff64
2613eae
8744da1
00d04e8
bcd1e05
4b2e42b
3f64cc1
2b102a8
b692765
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.github | ||
.gitignore | ||
codecov.yaml | ||
LICENSE | ||
README.md | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: build | ||
run: docker build . -t modern-cpp | ||
|
||
- name: test | ||
run: docker run modern-cpp sh -c "./build/test/GreeterTests" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM gcc:9.2 | ||
leozz37 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Installing Dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Installing CMake | ||
RUN wget "https://github.com/Kitware/CMake/releases/download/v3.18.3/cmake-3.18.3-Linux-x86_64.sh" \ | ||
&& chmod a+x cmake-3.18.3-Linux-x86_64.sh \ | ||
&& ./cmake-3.18.3-Linux-x86_64.sh --prefix=/usr/local --skip-license \ | ||
&& rm cmake-3.18.3-Linux-x86_64.sh | ||
|
||
# Copying files | ||
COPY . /app | ||
WORKDIR /app | ||
Comment on lines
+16
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably explicitly specify which files and directories to copy to avoid copying unwanted files or previous build artefacts to the container. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the updates! Tbh I still prefer explicitly copying the necessary directories and files as opposed to blacklisting.
Alternatively, we could copy only files tracked by git for a clean container state. |
||
|
||
# Building | ||
RUN cmake -Hall -Bbuild \ | ||
&& cmake --build build | ||
TheLartians marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Running | ||
CMD [ "./build/standalone/Greeter" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: "3.8" | ||
|
||
services: | ||
application: | ||
build: . | ||
image: greeter | ||
container_name: greeter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing EOF newline! 😱