toy/Dockerfile
Ryan Cavicchioni 88ec2f20b1
Some checks failed
Gitea Actions Demo / release-image (push) Failing after 41s
allow pid creation as ruby user
2024-07-02 16:48:39 -05:00

54 lines
806 B
Docker

FROM ruby:alpine AS base
WORKDIR /app
RUN <<EOT
gem update --system --no-document
gem install -N bundler
apk update
apk upgrade --no-cache
EOT
RUN mkdir -p /run/app
FROM base AS build
RUN <<EOT
apk add gcc musl-dev ruby-dev make
EOT
COPY Gemfile* .
RUN <<EOT
bundle config set --local without development
bundle install
EOT
FROM build AS dev
WORKDIR /app
RUN <<EOT
bundle install
EOT
CMD [ "sleep", "infinity" ]
FROM base
# RUN useradd ruby --home /app --shell /bin/sh
RUN adduser ruby -h /app -D
USER ruby:ruby
RUN mkdir -p /run/app
RUN chown ruby: /run/app
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build --chown=ruby:ruby /app /app
COPY --chown=ruby:ruby . .
EXPOSE 4567
CMD [ "bundle", "exec", "rackup", "--host", "0.0.0.0", "--port", "4567" ]