Skip to content

Instantly share code, notes, and snippets.

@erangaeb
Created November 12, 2022 09:53
Show Gist options
  • Save erangaeb/487d9e08e596efd45982e5d25568a303 to your computer and use it in GitHub Desktop.
Save erangaeb/487d9e08e596efd45982e5d25568a303 to your computer and use it in GitHub Desktop.
dockerize consul backend
# base image
FROM alpine:3.14
# set consul version
ENV CONSUL_VERSION 1.10.2
# create a new directory
RUN mkdir /consul
# download dependencies
RUN apk --no-cache add \
bash \
ca-certificates \
wget \
curl
# download and set up consul
RUN wget --quiet --output-document=/tmp/consul.zip https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip && \
unzip /tmp/consul.zip -d /consul && \
rm -f /tmp/consul.zip && \
chmod +x /consul/consul
# update PATH
ENV PATH="PATH=$PATH:$PWD/consul"
# add the config file
COPY ./config/consul-config.json /consul/config/config.json
# expose ports
EXPOSE 8300 8400 8500 8600
# run consul
ENTRYPOINT ["consul"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment