diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..37748c5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +Makefile +_site diff --git a/Dockerfile b/Dockerfile index 878bd58..72dc9c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,14 +9,9 @@ COPY Gemfile.lock /home COPY _vendor /home/_vendor WORKDIR /home RUN bundle install +COPY . /home +RUN jekyll build -FROM ruby:3.2.2-alpine - -RUN apk update && apk add git - -COPY --from=builder /usr/local/bundle /usr/local/bundle -RUN mkdir -p /home -WORKDIR /home - -CMD ["jekyll", "serve", "--host", "0.0.0.0"] +FROM nginx +COPY --from=builder /home/_site /usr/share/nginx/html diff --git a/Makefile b/Makefile index 0580573..6ed07ac 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,19 @@ build: # Build Docker image docker build -t distrust-co . - # Export site to _site directory - docker run -v $(shell pwd):/home -it distrust-co jekyll build +.PHONY: fullclean +fullclean: clean + docker rmi distrust-co + +.PHONY: clean +clean: + rm -r _site + +_site: build + mkdir -p _site + docker run distrust-co tar c -C /usr/share/nginx/html . | tar x -C _site .PHONY: serve serve: # Run Docker container with listener for current dir and port mapping - docker run -v $(shell pwd):/home -p 0.0.0.0:4000:4000 -it distrust-co - -.PHONY: clean -clean: - # Remove _site directory - rm -rf _site + docker run --rm -p 0.0.0.0:4000:80 -it distrust-co