navarasu / serverless-ruby-layer

A Serverless Plugin to deploy gems from Gemfile to AWS Layer
MIT License
72 stars 12 forks source link

Building via docker on GitHub actions? #37

Open NARKOZ opened 3 years ago

NARKOZ commented 3 years ago

Currently when I try to run sls deploy on github actions it fails with:

Serverless: Zipping the gemfiles and native libs to /home/runner/work/repo/repo/.serverless/ruby_layer/gemLayer.zip

 Exception -----------------------------------------------

  [OperationalError: EACCES: permission denied, scandir '/home/runner/work/repo/repo/.serverless/ruby_layer/build/ruby/2.7.0/gems/pg-1.2.3/ext/.gem.20210317-1-q5o5ls'] {
    cause: [Error: EACCES: permission denied, scandir '/home/runner/work/repo/repo/.serverless/ruby_layer/build/ruby/2.7.0/gems/pg-1.2.3/ext/.gem.20210317-1-q5o5ls'] {
      errno: -13,
      code: 'EACCES',
      syscall: 'scandir',
      path: '/home/runner/work/repo/repo/.serverless/ruby_layer/build/ruby/2.7.0/gems/pg-1.2.3/ext/.gem.20210317-1-q5o5ls'
    },
    isOperational: true,
    errno: -13,
    code: 'EACCES',
    syscall: 'scandir',
    path: '/home/runner/work/repo/repo/.serverless/ruby_layer/build/ruby/2.7.0/gems/pg-1.2.3/ext/.gem.20210317-1-q5o5ls'
  }

My serverless config contains:

custom:
  rubyLayer:
    use_docker: true
    docker_file: Dockerfile
    native_libs:
      - /usr/lib64/libpq.so.5
      - /usr/lib64/libldap_r-2.4.so.2
      - /usr/lib64/liblber-2.4.so.2
      - /usr/lib64/libsasl2.so.3
      - /usr/lib64/libssl3.so
      - /usr/lib64/libsmime3.so
      - /usr/lib64/libnss3.so
navarasu commented 3 years ago

Thanks Nihad for raising the issue. I will check this issue with simple example from my side. Meanwhile please share your gemfile that you have used.

NARKOZ commented 3 years ago

Gemfile:

source 'https://rubygems.org'

gem 'pg'
gem 'jwt'
gem 'i18n'
gem 'aws-sdk-ssm'
gem 'aws-sdk-lambda'
gem 'activemodel', '~> 6.1', require: 'active_model'
gem 'activerecord', '~> 6.1', require: 'active_record'
gem 'activesupport', '~> 6.1', require: 'active_support'
starverdiyev commented 3 years ago

The same error. Was checked on all ubuntu versions on Github actions.