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 7 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
42 changes: 42 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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"

RUN groupadd --gid 1000 worker && \
useradd \
--uid 1000 \
--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 -f Dockerfile ..
```

## Examples

The simples example will build all firmware files from dev branch to /tmp/firmware.
mcspr marked this conversation as resolved.
Show resolved Hide resolved

```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
```