Skip to content

Commit

Permalink
Use an alpine base image
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi REY committed Apr 15, 2020
1 parent 5b7b9d5 commit 6bc734d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 72 deletions.
61 changes: 39 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
FROM ubuntu:19.10
FROM golang:1.14.2-alpine3.11 as gobuilder

RUN apt update && apt install -y ruby ruby-dev build-essential wget
ARG GOOS=linux
ARG GOARCH=amd64
ARG CGO_ENABLED=0

COPY Gemfile .
RUN gem install bundler
RUN bundle install
RUN apk add --no-cache --update \
bash \
binutils \
build-base \
ca-certificates \
curl

ENV TERRAGRUNT_VERSION=0.23.8

RUN wget https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 && \
mv terragrunt_linux_amd64 /usr/bin/terragrunt && \
chmod 755 /usr/bin/terragrunt
RUN curl -fsSL -o /usr/local/bin/terragrunt \
https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64

ENV TERRAFORM_VERSION=0.12.24

RUN wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
RUN curl -fsSL -O https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
mv terraform /usr/bin/ && \
chmod 755 /usr/bin/terraform && \
rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip

ENV OPA_VERSION=0.18.0
mv terraform /usr/local/bin/

RUN wget https://github.com/open-policy-agent/opa/releases/download/v${OPA_VERSION}/opa_linux_amd64 && \
mv opa_linux_amd64 /usr/bin/opa && \
chmod 755 /usr/bin/opa
ENV OPA_VERSION=0.19.1
WORKDIR /opa-build
RUN curl -fsSL "https://codeload.github.com/open-policy-agent/opa/tar.gz/v${OPA_VERSION}" | tar xvz --strip-components=1 && \
go build && \
mv opa /usr/local/bin/

ENV CONFTEST_VERSION=0.18.1
RUN curl -fsSL https://github.com/instrumenta/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz | \
tar xz conftest -C /usr/local/bin/

RUN strip --strip-all /usr/local/bin/* && \
chmod 0755 /usr/local/bin/*

FROM alpine:3.11.5
LABEL maintainer="Rémi REY <[email protected]>"

COPY --from=gobuilder /usr/local/bin/ /usr/bin/
COPY Gemfile .

RUN wget https://github.com/instrumenta/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_linux_amd64.deb && \
dpkg -i conftest_${CONFTEST_VERSION}_linux_amd64.deb && \
rm conftest_${CONFTEST_VERSION}_linux_amd64.deb
RUN apk add --no-cache --update \
ruby && \
apk add --no-cache --update --virtual build-dependencies \
build-base \
ruby-dev && \
gem install bundler && \
bundle config set no-cache true && \
bundle install --jobs $(getconf _NPROCESSORS_ONLN) && \
apk del build-dependencies
50 changes: 0 additions & 50 deletions Dockerfile.alpine

This file was deleted.

0 comments on commit 6bc734d

Please sign in to comment.