From 6e965514c5fc005afbb476436c6dabc8b24dd3bb Mon Sep 17 00:00:00 2001 From: Wolmin Date: Tue, 27 Aug 2024 17:09:46 +0200 Subject: [PATCH 1/2] Add initial dockerfile and workflow for clientdiversity FE --- .github/workflows/publish-tag.yaml | 48 ++++++++++++++++++++++++++++++ Dockerfile | 27 +++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/publish-tag.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/publish-tag.yaml b/.github/workflows/publish-tag.yaml new file mode 100644 index 0000000..ade8f80 --- /dev/null +++ b/.github/workflows/publish-tag.yaml @@ -0,0 +1,48 @@ +name: Publish Docker tag images + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +env: + DOCKER_REGISTRY: europe-docker.pkg.dev + DOCKER_IMAGE_NAME: lks-lz-artifacts/docker-clientdiversity/frontend + +jobs: + build-docker: + permissions: + contents: "read" + id-token: "write" + runs-on: ubuntu-latest + steps: + - name: Checkout ${{ inputs.sha }} + uses: actions/checkout@v2 + + - name: Setup buildx + uses: docker/setup-buildx-action@v2 + + - name: Authenticate to Google Cloud + id: gcpauth + uses: google-github-actions/auth@v1 + with: + create_credentials_file: "true" + workload_identity_provider: "projects/311968610280/locations/global/workloadIdentityPools/github/providers/github" + service_account: "artifact-deployer@lks-lz-management.iam.gserviceaccount.com" + + - name: login + run: |- + gcloud auth login --brief --cred-file="${{ steps.gcpauth.outputs.credentials_file_path }}" + gcloud auth configure-docker ${{ env.DOCKER_REGISTRY }} + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile + push: true + build-args: | + GIT_TAG=${{ github.ref_name }} + tags: | + ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }} + ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:latest + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f8a7ef3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM ruby:3.4.0-preview1-alpine3.20 + +WORKDIR /app + +ENV BUNDLE_PATH=/app/vendor/bundle +ENV BUNDLER_VERSION='2.2.23' + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache jq build-base curl bash && \ + gem install bundler -v $BUNDLER_VERSION + +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + truncate -s 0 /var/log/*log + +RUN bundle config set --local path 'vendor/bundle' +COPY Gemfile Gemfile.lock /app/ + +RUN bundle install + +USER root + +COPY . /app + +RUN echo $GEM_PATH +RUN $GEM_PATH + From fc4f94082fe76a163a091502511f30331cf0a4a9 Mon Sep 17 00:00:00 2001 From: Wolmin Date: Thu, 29 Aug 2024 14:08:10 +0200 Subject: [PATCH 2/2] Provide a working dockerfile --- Dockerfile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index f8a7ef3..46f672e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ -FROM ruby:3.4.0-preview1-alpine3.20 +FROM ruby:3.3-alpine3.20 WORKDIR /app ENV BUNDLE_PATH=/app/vendor/bundle -ENV BUNDLER_VERSION='2.2.23' +ENV BUNDLER_VERSION='2.5.14' + +COPY . /app RUN apk update && \ apk upgrade && \ @@ -14,14 +16,10 @@ RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ truncate -s 0 /var/log/*log RUN bundle config set --local path 'vendor/bundle' -COPY Gemfile Gemfile.lock /app/ - RUN bundle install -USER root - -COPY . /app +EXPOSE 4000 -RUN echo $GEM_PATH -RUN $GEM_PATH +ENTRYPOINT ["bundle"] +CMD ["exec", "jekyll", "serve"]