Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run a command in github action service containers?

I am using minio to create an s3 like object-store server and I want to test some code against this server during my ci cd process.
Using Github actions, I tried to add minio as service in the workflow file but since minio requires a command and some arguments I can't actually run it using this mechanism.
This is the part of the relevant configuration from my ci.yml:

minio-container:
runs-on: ubuntu-latest
container: python:3.8.2

services:
  minio:
    image: minio/minio:latest
    ports:
      - 9000:9000
    env:
      MINIO_ACCESS_KEY: XXXX
      MINIO_SECRET_KEY: XXXXX

I read a little bit and figured out that behind the scene github runs the docker crate service [OPTIONS] IMAGE_NAME but I need to also be able to run docker create service [OPTIONS] IMAGE_NAME COMMAND [ARGS]

In case this is not implemented yet what are other options I can try?

like image 565
Or Chen Avatar asked Mar 25 '20 13:03

Or Chen


1 Answers

From a quick look at the Github Actions documentation this is not yet supported. You could easily get around this by using the Minio image from Bitnami .

I believe something like this should work:

    services:
  minio:
    image: bitnami/minio:latest
    env:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
    ports:
      - 9000:9000
    options: --name minio-server
like image 58
Aristos Diamadis Avatar answered Oct 02 '22 01:10

Aristos Diamadis