Dockerfile, Makefile: build into nginx container
This commit is contained in:
parent
c66428703c
commit
f645dd5cc0
|
@ -0,0 +1,3 @@
|
|||
Dockerfile
|
||||
Makefile
|
||||
_site
|
13
Dockerfile
13
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
|
||||
|
|
20
Makefile
20
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
|
||||
|
|
Loading…
Reference in New Issue