Skip to content

Commit

Permalink
added docker-squash, removed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
dmalan committed Jan 27, 2024
1 parent 20cf242 commit d41ceb0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ jobs:
cache-from: type=registry,ref=cs50/cli:amd64-buildcache
cache-to: type=registry,ref=cs50/cli:amd64-buildcache,mode=max

- name: Squash for linux/amd64
if: ${{ github.ref == 'refs/heads/develop' }}
run: |
pip3 install docker-squash
docker-squash --cleanup --tag cs50/cli:amd64 cs50/cli:amd64
- name: Push linux/amd64 build to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
run: |
Expand All @@ -42,6 +48,12 @@ jobs:
cache-from: type=registry,ref=cs50/cli:arm64-buildcache
cache-to: type=registry,ref=cs50/cli:arm64-buildcache,mode=max

- name: Squash for linux/arm64
if: ${{ github.ref == 'refs/heads/develop' }}
run: |
pip3 install docker-squash
docker-squash --cleanup --tag cs50/cli:arm64 cs50/cli:arm64
- name: Push linux/arm64 build to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
run: |
Expand Down
12 changes: 1 addition & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RUN cd /tmp && \
tar xzf Python-3.11.7.tgz && \
rm --force Python-3.11.7.tgz && \
cd Python-3.11.7 && \
CFLAGS="-Os" ./configure --enable-optimizations --without-tests && \
CFLAGS="-Os" ./configure --disable-static --enable-optimizations --enable-shared --with-lto --without-tests && \
./configure && \
make && \
make install && \
Expand Down Expand Up @@ -205,7 +205,6 @@ RUN apt update && \
nano \
openssh-client `# For ssh-keygen` \
psmisc `# For fuser` \
ruby-dev `# Ruby development headers` \
sudo \
tzdata `# For TZ` \
unzip \
Expand Down Expand Up @@ -239,15 +238,6 @@ RUN pip3 install --no-cache-dir \
"submit50<4"
# Install GitHub CLI (after builder stage, because writes to /usr/share)
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
RUN curl --fail --location --show-error --silent https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
apt update && \
apt install --no-install-recommends --no-install-suggests --yes gh
# Copy files to image
COPY ./etc /etc
COPY ./opt /opt
Expand Down
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
.PHONY: default
default: run

build:
docker build --build-arg VCS_REF="$(shell git rev-parse HEAD)" -t cs50/cli .
docker build --build-arg VCS_REF="$(shell git rev-parse HEAD)" --tag cs50/cli .
$(MAKE) squash

depends:
pip3 install docker-squash

rebuild:
docker build --no-cache -t cs50/cli .
docker build --no-cache --tag cs50/cli .
$(MAKE) squash

run:
docker run --env LANG="$(LANG)" -it -P --rm --security-opt seccomp=unconfined -v "$(PWD)":/home/ubuntu cs50/cli bash --login || true
docker run --env LANG="$(LANG)" --interactive --publish-all --rm --security-opt seccomp=unconfined --tty --volume "$(PWD)":/home/ubuntu cs50/cli bash --login || true

squash: depends
docker-squash --tag cs50/cli cs50/cli

0 comments on commit d41ceb0

Please sign in to comment.