Skip to content

Commit

Permalink
feat(ci): Build the Docker image in GitHub Actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
whisperity committed May 22, 2024
1 parent 091fef6 commit f519f9d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
LICENSE
README.md
30 changes: 30 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Docker Image CI"

on:
push:
pull_request:

jobs:
build:
env:
RUNS_ON: "ubuntu-20.04"
runs-on: "ubuntu-20.04"
steps:
- name: "Build Docker Image"
uses: docker/build-push-action@v5
with:
load: true
tags: "distcc-docker:${{ env.RUNS_ON }}"
- name: "Simple test"
run: |
docker run \
--init \
--rm \
"distcc-docker:${{ env.RUNS_ON }}"
--jobs $(nproc) \
-- \
bash -c \
"ps fauxw; " \
"/usr/bin/ls -alh .; " \
"/usr/bin/ls -alh /var/log; " \
"cat /var/log/*;"
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ ENV \
LC_ALL="en_US.UTF-8"


COPY etc/ /etc/
COPY usr/ /usr/


# Set to non-zero if the compilers should only be installed into the container,
# and not immediately baked into the image itself.
ARG LAZY_COMPILERS=0

COPY usr/local/sbin/install-compilers.sh /usr/local/sbin/install-compilers.sh
RUN \
if [ "x$LAZY_COMPILERS" = "x0" ]; \
then \
Expand Down Expand Up @@ -67,6 +65,10 @@ RUN echo "Creating service user: $USERNAME ..." >&2 && \
chmod -v 444 "/var/lib/distcc/distcc.user"


COPY etc/ /etc/
COPY usr/ /usr/


# Expose the DistCC server's normal job and statistics subservice port.
# Custom ports to be used on the host machine should be managed via Docker.
EXPOSE \
Expand Down
2 changes: 1 addition & 1 deletion usr/local/sbin/container-main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ if [ "$EXEC_CUSTOM" -eq 1 ]; then
echo "[...] distcc service is running." >&2
fi

custom_command $@
custom_command "$@"
EXIT_CODE=$?

atexit
Expand Down

0 comments on commit f519f9d

Please sign in to comment.