lavenderguitar
3 years ago
3 changed files with 56 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||||
|
FROM --platform=linux/amd64 ubuntu:20.04 AS base |
||||
|
RUN apt-get update \ |
||||
|
&& apt-get install -y --no-install-recommends \ |
||||
|
ruby-full ruby-bundler python3 \ |
||||
|
git build-essential zlib1g-dev \ |
||||
|
&& rm -rf /var/lib/apt/lists/* \ |
||||
|
&& groupadd -g 1000 jekyll \ |
||||
|
&& useradd -mu 1000 -g jekyll jekyll |
||||
|
USER jekyll |
||||
|
WORKDIR /home/jekyll |
||||
|
ENV GEM_HOME=/home/jekyll/gems \ |
||||
|
PATH="/home/jekyll/gems/bin:${PATH}" |
||||
|
COPY Gemfile Gemfile.lock ./ |
||||
|
RUN bundle install |
||||
|
|
||||
|
FROM base AS generate |
||||
|
COPY --chown=jekyll:jekyll . ./src |
||||
|
WORKDIR /home/jekyll/src |
||||
|
RUN bundle exec jekyll build --destination /home/jekyll/build --trace |
||||
|
|
||||
|
FROM nginx:1.21-alpine |
||||
|
COPY ./deploy/default.conf /etc/nginx/conf.d/default.conf |
||||
|
COPY --from=generate /home/jekyll/build /usr/share/nginx/html |
@ -0,0 +1,21 @@ |
|||||
|
server { |
||||
|
listen 80; |
||||
|
server_name localhost; |
||||
|
default_type text/html; |
||||
|
|
||||
|
root /usr/share/nginx/html; |
||||
|
|
||||
|
location / { |
||||
|
index index.html index.htm; |
||||
|
} |
||||
|
|
||||
|
location /post { |
||||
|
try_files $uri $uri.html; |
||||
|
} |
||||
|
|
||||
|
#error_page 404 /404.html; |
||||
|
error_page 500 502 503 504 /50x.html; |
||||
|
location = /50x.html { |
||||
|
root /usr/share/nginx/html; |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
docker build --network host -f deploy/Dockerfile --tag $IMGREPO . |
||||
|
|
||||
|
# M1 Mac users may need to use buildx to specify the proper platform for the build. |
||||
|
# Comment out the line above and uncomment this one as necessary. |
||||
|
# docker buildx build -f deploy/Dockerfile --tag $IMGREPO --platform=linux/amd64 . |
||||
|
|
||||
|
docker push $IMGREPO |
||||
|
|
||||
|
# Uncomment to run a container locally using the new image (for testing). |
||||
|
# docker run --rm -it -p 127.0.0.1:8080:80 $IMGREPO |
Loading…
Reference in new issue