Skip to content
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

Docker build #1754

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.s#?
*.b#?
.modgit
firmware*
*.gch
.pio*
.clang_complete
.gcc-flags.json
.sconsign.dblite
.python
.env
.DS_Store
.vscode
45 changes: 45 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM debian:buster-slim

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python2-minimal \
python-pip \
python-setuptools \
ca-certificates \
nodejs \
npm \
git \
&& rm -rf /var/lib/apt/lists/* \
mcspr marked this conversation as resolved.
Show resolved Hide resolved
&& npm install -g npm \
&& pip install "platformio>=3.6,<3.7"

ARG UID=1000
ARG GID=1000

RUN groupadd --gid $GID worker && \
useradd \
--uid $UID \
--gid worker \
--shell /bin/bash \
--create-home worker

RUN mkdir -p /espurna && \
mkdir -p /firmware && \
chown -R worker:worker /espurna && \
chown -R worker:worker /firmware

COPY --chown=worker:worker . /espurna
Copy link
Collaborator

@mcspr mcspr Jun 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.dockerignore is needed then (in code/ or at the top?)
we need to ignore platformio build directories
code/.pio
code/.piolibdeps
code/.pioenvs

code/node_modules

and some things from gitignore, vscode & ds_store


USER worker

WORKDIR /espurna/code

RUN npm install --only=dev && \
platformio run --target clean

VOLUME ["/espurna", "/firmware"]

ENTRYPOINT ["./build.sh", "-d", "/firmware"]
CMD []
28 changes: 28 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Docker build image

This directory contains a docker file for an ESPurna build environment.

Two volumes can be used.
* `/espurna` with ESPurna source code.
* `/firmware` target directory for complied firmware files.

## Build

```bash
docker build -t espurna-build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f Dockerfile ..
```

## Examples

This simple example will build all firmware files from dev branch to /tmp/firmware.

```bash
docker run --rm -it -v /tmp/firmware/:/firmware espurna-build
```


This example will only build firmware for environment `intermittech-quinled` from local files in `/home/user/espurna`

```bash
docker run --rm -it -v /tmp/firmware/:/firmware -v /home/user/espurna/:/espurna espurna-build intermittech-quinled
```