Skip to content

Commit

Permalink
Compile in docker at entrypoint instead of image creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasz-lisowski committed Jun 25, 2024
1 parent 3e330bf commit 6955a19
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ compile_flags.txt
example/

# Docker output.
docker/
docker.log
2 changes: 1 addition & 1 deletion docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -o pipefail; # Don't hide errors within pipes.
set -o errexit; # Abort on non-zero exit status.

docker build --progress=plain . -t tomasz-lisowski/swicc:1.0.0 2>&1 | tee docker.log;
docker run -v ./docker:/opt/out --tty --interactive --rm tomasz-lisowski/swicc:1.0.0;
docker run -v .:/opt/swicc --tty --interactive --rm tomasz-lisowski/swicc:1.0.0;
26 changes: 3 additions & 23 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,7 @@ FROM ubuntu:22.04 AS base

RUN set -eux; \
apt-get -qq update; \
apt-get -qq --yes dist-upgrade;
apt-get -qq --yes dist-upgrade; \
apt-get -qq --yes --no-install-recommends install cmake gcc gcc-multilib make;


FROM base AS base__swicc
COPY . /opt/swicc
ENV DEP="cmake gcc gcc-multilib make"
RUN set -eux; \
apt-get -qq --yes --no-install-recommends install ${DEP}; \
cd /opt/swicc; \
make clean; \
make -j $(nproc) main-static test-static; \
apt-get -qq --yes purge ${DEP};


FROM base
COPY --from=base__swicc /opt/swicc/build /opt/swicc/build
COPY --from=base__swicc /opt/swicc/test/data /opt/swicc/test/data

RUN set -eux; \
rm -r /opt/swicc/build/swicc; \
rm -r /opt/swicc/build/test; \
rm -r /opt/swicc/build/cjson;

ENTRYPOINT [ "bash", "-c", "cp -r /opt/swicc/* /opt/out" ]
ENTRYPOINT [ "bash", "-c", "cd /opt/swicc && make clean && make -j $(nproc) main-static test-static" ]

0 comments on commit 6955a19

Please sign in to comment.