Skip to content

Commit

Permalink
chore: fix docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Oct 17, 2023
1 parent 479eaf7 commit 2f377bd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 18 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ permissions: read-all
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- docker-full
- docker-minimal
steps:
- name: Checkout code
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Build Container
run: make docker
run: make ${{matrix.target}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ generate: .bin/controller-gen
.bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./api/..."

# Build the docker image
docker:
docker build . -f build/full/Dockerfile -t ${IMG_F}
docker: docker-minimal docker-full

docker-full:
docker build . -f build/full/Dockerfile -t ${IMG}

docker-minimal:
docker build . -f build/minimal/Dockerfile -t ${IMG}

# Build the docker image
docker-dev: linux
docker build ./ -f build/dev/Dockerfile -t ${IMG}


docker-push-%:
docker build . -f build/full/Dockerfile -t ${IMG_F}
docker build . -f build/minimal/Dockerfile -t ${IMG}
Expand Down
7 changes: 4 additions & 3 deletions build/full/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN make build

FROM eclipse-temurin:11.0.20.1_1-jdk-jammy@sha256:1584fd589b45a67b6f56b0c702776ca3d5640d1001f7848f5bcd19cb10545eaa
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y curl unzip ca-certificates jq tzdata wget gnupg2 bzip2 apt-transport-https lsb-release python3 python3-pip --no-install-recommends && \
rm -Rf /var/lib/apt/lists/* && \
Expand Down Expand Up @@ -56,7 +57,7 @@ RUN curl -L https://github.com/restic/restic/releases/download/v${RESTIC_VERSION

ENV JMETER_VERSION=5.6.2
RUN curl -L https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-${JMETER_VERSION}.zip -o apache-jmeter-${JMETER_VERSION}.zip && \
unzip apache-jmeter-${JMETER_VERSION}.zip -d /opt && \
unzip -q apache-jmeter-${JMETER_VERSION}.zip -d /opt && \
rm apache-jmeter-${JMETER_VERSION}.zip

ENV PATH /opt/apache-jmeter-${JMETER_VERSION}/bin/:$PATH
Expand All @@ -78,7 +79,7 @@ RUN curl -Lsf https://sh.benthos.dev | bash -s -- 4.22.0

# Commandline tool for running SQL queries against JSON, CSV, Excel, Parquet, and more
RUN curl -L https://github.com/multiprocessio/dsq/releases/download/v0.23.0/dsq-linux-x64-v0.23.0.zip -o dsq.zip && \
unzip dsq.zip && \
unzip -q dsq.zip && \
mv dsq /usr/local/bin/dsq && \
rm dsq.zip

Expand All @@ -99,7 +100,7 @@ ENV PATH="${PATH}:/var/lib/canary/bin/"

# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && ./aws/install -i ${HOME}/aws -b ${HOME}/bin/ && \
unzip -q awscliv2.zip && ./aws/install -i ${HOME}/aws -b ${HOME}/bin/ && \
rm awscliv2.zip

# Install GCP CLI
Expand Down
30 changes: 19 additions & 11 deletions build/minimal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ RUN make build

FROM ubuntu:jammy-20231004@sha256:02410fbfad7f2842cce3cf7655828424f4f7f6b5105b0016e24f1676f3bd15f5
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y curl unzip ca-certificates jq tzdata wget gnupg2 bzip2 apt-transport-https lsb-release --no-install-recommends && \
rm -Rf /var/lib/apt/lists/* && \
rm -Rf /usr/share/doc && rm -Rf /usr/share/man && \
apt-get install -y curl unzip ca-certificates jq wget gnupg2 bzip2 apt-transport-https lsb-release --no-install-recommends && \
apt-get clean

COPY --from=builder /app/.bin/canary-checker /app
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata && \
apt-get clean

# Install alexellis/arkade as root
RUN curl -sLS https://get.arkade.dev | sh

RUN mkdir -p /etc/apt/keyrings && \
curl -sLS https://packages.microsoft.com/keys/microsoft.asc | \
Expand All @@ -35,6 +34,13 @@ RUN mkdir -p /etc/apt/keyrings && \
apt-get install -y azure-cli && \
apt-get clean

RUN apt-get update && apt-get upgrade -y && \
rm -Rf /var/lib/apt/lists/* && \
apt-get clean

# Install alexellis/arkade as root
RUN curl -sLS https://get.arkade.dev | sh

RUN mkdir /opt/database && groupadd --gid 1000 canary && \
useradd canary --uid 1000 -g canary -m -d /var/lib/canary && \
chown -R 1000:1000 /opt/database && chown -R 1000:1000 /app
Expand All @@ -48,15 +54,17 @@ ENV PATH="${PATH}:/var/lib/canary/bin/"

# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && ./aws/install -i ${HOME}/aws -b ${HOME}/bin/ && \
unzip -q awscliv2.zip && ./aws/install -i ${HOME}/aws -b ${HOME}/bin/ && \
rm awscliv2.zip

# Install GCP CLI
RUN curl -sL -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-441.0.0-linux-x86_64.tar.gz && \
tar -xf google-cloud-cli-441.0.0-linux-x86_64.tar.gz && \
ENV GCLOUD_VERSION=441.0.0
RUN curl -sL -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${GCLOUD_VERSION}-linux-x86_64.tar.gz && \
tar -xf google-cloud-cli-${GCLOUD_VERSION}-linux-x86_64.tar.gz && \
ln -sf /app/google-cloud-sdk/bin/gcloud ${HOME}/bin/gcloud && \
rm google-cloud-cli-441.0.0-linux-x86_64.tar.gz
rm google-cloud-cli-${GCLOUD_VERSION}-linux-x86_64.tar.gz

RUN /app/canary-checker go-offline
COPY --from=builder /app/.bin/canary-checker /app

RUN /app/canary-checker go-offline
ENTRYPOINT ["/app/canary-checker"]

0 comments on commit 2f377bd

Please sign in to comment.