Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ci-kubed v8.2.0 and convert to use remote buildkit cache mounts #3413

Merged
merged 7 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# syntax = docker/dockerfile:1.5.2

# syntax = docker/dockerfile:1.8.1
FROM phusion/passenger-customizable:1.0.19 AS base

RUN mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak && \
RUN --mount=type=cache,id=playbook-apt-cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=playbook-apt-lib,target=/var/lib/apt,sharing=locked \
apt-get update -y && \
mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak && \
apt update && apt install -y ca-certificates && \
mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d

RUN bash -lc 'rvm remove all --force && rvm install ruby-3.3.0 && rvm --default use ruby-3.3.0 && gem install bundler -v 2.5.3'
RUN /pd_build/ruby_support/install_ruby_utils.sh
RUN --mount=type=cache,id=playbook-apt-cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=playbook-apt-lib,target=/var/lib/apt,sharing=locked \
/pd_build/ruby_support/install_ruby_utils.sh
RUN /pd_build/ruby_support/finalize.sh

ENV BUNDLE_TO /usr/local/rvm/gems
Expand All @@ -26,10 +30,9 @@ RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/insta
&& nvm use default \
&& npm install -g npm@$NPM_VERSION yarn@$YARN_VERSION

RUN apt-get update -y \
&& apt-get install -y shared-mime-info=1.15-1\
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN --mount=type=cache,id=playbook-apt-cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=playbook-apt-lib,target=/var/lib/apt,sharing=locked \apt-get update -y \
&& apt-get install -y shared-mime-info=1.15-1

RUN bundle config --global silence_root_warning 1

Expand All @@ -55,7 +58,8 @@ FROM base as rubydeps
# Bundle website
COPY --link --chown=9999:9999 --from=rubypackages /home/app/src /home/app/src
COPY --link --chown=9999:9999 playbook/lib/playbook /home/app/src/playbook/lib/playbook
RUN cd playbook-website && bundle install
RUN --mount=type=cache,id=playbook-bundler-gem-cache,uid=9999,gid=9999,target=/home/app/.bundle/cache \
cd playbook-website && bundle install

FROM base as jsdeps

Expand All @@ -64,15 +68,17 @@ COPY --link .yarn ./.yarn
COPY --link --chown=9999:9999 --from=jspackages /home/app/src /home/app/src

# Build Library
RUN --mount=id=yarncache,type=cache,target=/home/app/.cache/yarn,uid=9999,gid=9999,sharing=locked \
RUN --mount=id=playbook-yarncache,type=cache,target=/home/app/.cache/yarn,uid=9999,gid=9999,sharing=locked \
yarn install --frozen-lockfile

FROM jsdeps AS release
COPY --from=rubydeps --link $BUNDLE_TO $BUNDLE_TO
COPY --link --chown=9999:9999 playbook /home/app/src/playbook
COPY --link --chown=9999:9999 playbook-website /home/app/src/playbook-website
RUN cd playbook; NODE_OPTIONS=$NODE_OPTIONS yarn release
RUN cd playbook-website; NODE_OPTIONS=$NODE_OPTIONS yarn release
RUN --mount=id=playbook-yarncache,type=cache,target=/home/app/.cache/yarn,uid=9999,gid=9999,sharing=locked \
cd playbook; NODE_OPTIONS=$NODE_OPTIONS yarn release
RUN --mount=id=playbook-yarncache,type=cache,target=/home/app/.cache/yarn,uid=9999,gid=9999,sharing=locked \
cd playbook-website; NODE_OPTIONS=$NODE_OPTIONS yarn release

FROM base AS prod
COPY --from=rubydeps --link $BUNDLE_TO $BUNDLE_TO
Expand Down
9 changes: 4 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env groovy

library 'github.com/powerhome/ci-kubed@v6.10.1'
library 'github.com/powerhome/ci-kubed@v8.2.0'

app.build(
resources: [
Expand All @@ -12,15 +12,14 @@ app.build(
) {
app.composeBuild(
appRepo: "image-registry.powerapp.cloud/playbook/playbook",
files: ["docker-compose.yml", "docker-compose.ci.yml"],
bakeFiles: ['docker-bake.hcl']
files: ["docker-compose.yml", "docker-compose.ci.yml"]
) { compose ->
stage('Image Build') {
compose.bake()
compose.bake(bakeFiles: ['docker-bake.hcl'])
}

stage('Test') {
compose.command "run --workdir /home/app/src/playbook web ./test.sh"
shell "docker compose run --workdir /home/app/src/playbook web ./test.sh"
}
}
}
Loading