by kureikain · 6y ago · 0 comments
I don't know why they didn't allow us to use any docker image we want so we don't have to waste time to use actions to install dependencies...Eg, if your app depend on both Go, Ruby, Node at build time you will need:
https://github.com/actions/setup-go https://github.com/actions/setup-node https://github.com/actions/setup-ruby
I much prefer CircleCI way
Without that, they'll run directly on the virtual machine that you specify.
I don't know what this means. Are there any examples?
Running in a container is the one big thing I'm missing and couldn't find any documentation about.
- name: build
run: |
docker run --rm -v \
"$PWD":/usr/src/my-project \
-w /usr/src/my-project \
-e GOOS -e GOARCH \
golang:1.13 go build -v -o my-project-$GOOS-$GOARCH
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
(GitHub Actions's build environment already has Docker installed/configured, so there's no setup necessary for "run: docker run" to work.)I did this explicitly because I didn't want to use that "setup-go" action you linked, which at the time (I haven't doubled checked it recently) didn't support Go 1.13. Far better to me to use the Docker image, which has explicit instructions even for cross-platform compilation in its README, than rely on some weird action setup, in my opinion.
- name: Build
run: docker build -t me/image:latest .
env:
DOCKER_BUILDKIT: 1
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}...unless your Dockerfile ends up doing that too? If so I'd be interested to see it if you're willing to share!
Why be specific? Why not include a shell-script in your repository, and allow that to run the tests? That way you just need one "Run test-script" action:
https://github.com/bbs-io/syncterm-windows/blob/master/.gith...
Can you imagine allowing anyone on the internet to run an arbitrary container on your server for free?
I built an old-style Docker container (i.e., one that runs code like "apt-get install foo") on Github Actions successfully, so I assume Docker works fine. I haven't tried getting root on a build worker, but I imagine they mitigate that in some way. (Perhaps by having a pool of VMs and blowing it up after your build is done.)
I think what the OP is talking about is CI systems whose pipelines are declared by a series of "run this command in this container" instructions. Github Actions doesn't work that way, but you can still run containers.
Each step of a pipeline is just a docker container of your choice and running whatever commands you want with a persistent workspace volume throughout the pipeline.
There's a few others that work this way like Semaphore, Drone CI, GoCD, CircleCI, Azure Devops but none are as fast, seamless and easy as Buddy.