Use existing Dockerfile

I’ve been working away for weeks now on my project demo - as part of it I bought a jekyll site template which comes with it’s own dockerfile - I can’t be bothered maintaining both a dockerfild and the circle ci yaml separately. Can anyone recommend a way to just keep using the dockerfile and a Makefile?

Sure, if you can tell us what your CircleCI config and your Dockerfile do. Would you post them here?

You will always need a minimal CircleCI config, but you can certainly do a Docker build inside your build server.

Thanks @halfer - it’s really basic - just builds/serves a jekyll site - currently hosted on github but I’d like to play with deploying it to kubernetes.

FROM alpine:latest

# Set default locale for the environment
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

RUN apk add ruby-bundler ruby-dev 

# throw errors if Gemfile has been modified since Gemfile.lock
#RUN bundle config --global frozen 1

WORKDIR /usr/src/app

COPY Gemfile Gemfile.lock jekyll-mergefailure-theme.gemspec ./

RUN apk add make gcc dev86 

RUN apk add build-base

RUN apk add zlib

#RUN apk add libxml2 libxslt musl ruby ruby-libs ruby-mini_portile2

RUN apk add ruby-nokogiri ruby-json

RUN bundle install

EXPOSE 4000

CMD ["bundle", "exec", "jekyll", "help"]
```

@halfer - I haven’t even approached the circleci config yet - I just saw a sea of yaml and couldn’t figure out from the docs how I could get it to use the Dockerfile.

It’s just using Docker pretty much as you would locally - pull the repo, install Docker, do a docker build, then do a docker run if required. Here is an example:

Ah, understood - docker in docker. Thanks for the pointer @halfer, much appreciated.

1 Like

Yep, and you’re welcome. The CircleCI config then is just a question of keeping up to date with Docker/Compose, and otherwise does not really need to change.