-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Seperate Containerfile into two files
- Loading branch information
Showing
3 changed files
with
73 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ name: Create and push a continer image | |
|
||
on: | ||
push: | ||
branches: ['main'] | ||
branches: ['latest'] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
IMAGE_NAME: zifeitong/ubuntu-devpack | ||
|
||
jobs: | ||
build-and-push-image: | ||
|
@@ -43,8 +43,7 @@ jobs: | |
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: ./Containerfile | ||
target: ubuntu-devpack | ||
file: ./Containerfile.ubuntu-devpack | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
FROM docker.io/library/ubuntu:24.04 AS builder | ||
|
||
# Install packages needed for building packages. | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -y install \ | ||
g++ openjdk-11-jdk-headless golang curl git libelf-dev libcap-dev && \ | ||
rm -rd /var/lib/apt/lists/* | ||
|
||
ARG TARGETARCH | ||
ARG BAZELISK_URL=https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux- | ||
ARG BUILDIFIER_URL=https://github.com/bazelbuild/buildtools/releases/latest/download/buildifier-linux- | ||
ARG BUILDOZER_URL=https://github.com/bazelbuild/buildtools/releases/latest/download/buildozer-linux- | ||
|
||
# Install bazel | ||
RUN curl --proto '=https' --tlsv1.3 -sSfL ${BAZELISK_URL}${TARGETARCH} > bazel | ||
RUN chmod +x bazel | ||
RUN curl --proto '=https' --tlsv1.3 -sSfL ${BUILDIFIER_URL}${TARGETARCH} > buildifier | ||
RUN curl --proto '=https' --tlsv1.3 -sSfL ${BUILDOZER_URL}${TARGETARCH} > buildozer | ||
|
||
# Install copybara | ||
RUN git clone https://github.com/google/copybara.git --depth=1 | ||
WORKDIR /copybara | ||
RUN /bazel build //java/com/google/copybara:copybara_deploy.jar -c opt | ||
|
||
# Install perf_data_converter | ||
WORKDIR / | ||
RUN git clone https://github.com/google/perf_data_converter.git --depth=1 | ||
WORKDIR /perf_data_converter | ||
RUN /bazel build src:perf_to_profile -c opt | ||
|
||
# Install pprof | ||
WORKDIR / | ||
RUN git clone https://github.com/google/pprof.git --depth=1 | ||
WORKDIR /pprof | ||
RUN go build | ||
|
||
FROM docker.io/library/ubuntu:24.04 as ubuntu-devpack | ||
LABEL name="ubuntu-debpack" version="24.04" | ||
|
||
# Remove apt configuration optimized for containers | ||
RUN rm /etc/apt/apt.conf.d/docker-gzip-indexes /etc/apt/apt.conf.d/docker-no-languages | ||
|
||
# Delete the default 'ubuntu' user | ||
RUN userdel --remove ubuntu | ||
|
||
# Install packages | ||
COPY extra-packages / | ||
RUN apt-get update && \ | ||
yes | /usr/local/sbin/unminimize && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -y install \ | ||
ubuntu-minimal ubuntu-standard $(grep -v '^#' extra-packages | xargs) | ||
RUN rm /extra-packages | ||
|
||
COPY --from=builder --chmod=755 bazel buildifier buildozer /pprof/pprof \ | ||
/perf_data_converter/bazel-bin/src/perf_to_profile \ | ||
/usr/local/bin/ | ||
COPY --from=builder \ | ||
/copybara/bazel-bin/java/com/google/copybara/copybara_deploy.jar \ | ||
/opt/copybara/ | ||
COPY --chmod=755 <<"EOF" /usr/local/bin/copybara | ||
#!/usr/bin/env bash | ||
exec java -jar /opt/copybara/copybara_deploy.jar "$@" | ||
EOF | ||
|
||
# Disable APT ESM hook. | ||
RUN rm /etc/apt/apt.conf.d/20apt-esm-hook.conf | ||
|
||
# Update command-not-found database | ||
RUN apt-get update |