I would like to setup a GitHub Action to build my project and run tests locally. As I use .devcontainer I have a Dockerfile in .devcontainer/Dockerfile that provide everything I need to build my project.
Now I would like to write a GitHub Action to build the project on every push. Locally I would have done this:
docker build -t local - < .devcontainer/Dockerfile
docker run -it -v $(pwd):/srv -w/srv local make test
GitHub actions looks cumbersome, but I eventually wrote this:
on: push
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: check out repository
uses: actions/checkout@v2
- name: build project
container:
image: ".devcontainer/Dockerfile"
volumes:
- .:/srv
run: make test
Unfortunately it does not like the container keyword.
Any clues?