Skip to content

Commit

Permalink
Local image building
Browse files Browse the repository at this point in the history
  • Loading branch information
thebsdbox committed May 11, 2018
1 parent aa2f210 commit 7638497
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 7 additions & 4 deletions local_dockerfile/dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#Start from GNU Compiler Collection Latest
FROM alpine:latest

# Get required packages (vim is needed for xxd (not busybox edition))
RUN apk update; apk add gcc git musl-dev vim
#Get required packages (vim is needed for xxd (not busybox edition))
RUN apk update; apk add gcc git musl-dev vim tar

#Build dynamic UI
RUN xxd -i htmlfiles/index.html >> httpui.h
#Add archive
ADD tar/urchin.tar urchin

#Move to Urchin directory
WORKDIR "/urchin"

#Compile code, should be a makefile but meh
RUN gcc --static -s -Os -Wl,--discard-all -Wl,-O1 -Wall -o urchin main.c mem.c utils.c sig.c fork.c log.c httpd.c ui.c
Expand Down
7 changes: 4 additions & 3 deletions make_local_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ echo ""
echo "Dynamically building UI from ./htmlfiles"
xxd -i htmlfiles/index.html >> httpui.h
echo "Moving files to the dockerfile directory"
cp *.c ./local_dockerfile
cp *.h ./local_dockerfile
mkdir ./local_dockerfile/tar
find . -name "*.c" -o -name "*.h" | tar -cf ./local_dockerfile/tar/urchin.tar -T -
cd ./local_dockerfile
docker build -t urchin:local .
echo "Restoring local_dockerfile directory and include files"
git checkout -- ./local_dockerfile
rm -rf ./local_dockerfile/tar
cd ..
git checkout -- ./httpui.h

0 comments on commit 7638497

Please sign in to comment.