diff --git a/.dockerignore b/.dockerignore index a5d205b7..e69de29b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +0,0 @@ -# We don't use this repo's files to build the Docker image, we just gem install -* diff --git a/Dockerfile b/Dockerfile index ee7ec385..ef9283e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,29 @@ -FROM ruby:3.0-alpine -MAINTAINER Samuel Cochran +### BUILD +FROM ruby:3.0-alpine as build -ARG VERSION=0.8.2 +RUN apk update --no-cache --force \ + && apk add --no-cache \ + build-base \ + sqlite-libs \ + sqlite-dev -RUN apk add --no-cache build-base sqlite-libs sqlite-dev && \ - gem install mailcatcher -v $VERSION && \ - apk del --rdepends --purge build-base sqlite-dev +WORKDIR /app +COPY . . +RUN gem build mailcatcher.gemspec --output=mailcatcher.gem + +## FINAL +FROM ruby:3.0-alpine as final +LABEL maintainer="Samuel Cochran " + +WORKDIR /app +COPY --from=build /app/mailcatcher.gem /app/mailcatcher.gem +RUN apk update --no-cache --force \ + && apk add sqlite-libs \ + && apk add --no-cache --virtual build \ + build-base \ + sqlite-dev \ + && gem install /app/mailcatcher.gem \ + && apk del build EXPOSE 1025 1080