Skip to content

Instantly share code, notes, and snippets.

@metaver5o
Last active March 16, 2022 15:10
Show Gist options
  • Save metaver5o/52f5fd4f560f643ac29e724fde554c65 to your computer and use it in GitHub Desktop.
Save metaver5o/52f5fd4f560f643ac29e724fde554c65 to your computer and use it in GitHub Desktop.
truffle ganache multistage dockerfile
FROM node:16-bullseye-slim as base
RUN apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
python3 && \
rm -fr /var/lib/apt/lists/* && \
rm -rf /etc/apt/sources.list.d/*
RUN npm install --global --quiet npm truffle ganache
FROM base as truffle
RUN mkdir -p /home/app
WORKDIR /home/app
COPY package.json /home/app
COPY package-lock.json /home/app
RUN npm install --quiet
COPY truffle-config.js /home/app
COPY contracts /home/app/contracts
COPY migrations /home/app/migrations/
COPY test /home/app/test/
CMD ["truffle", "version"]
FROM base as ganache
RUN mkdir -p /home
WORKDIR /home
EXPOSE 8545
ENTRYPOINT ["ganache", "--host 0.0.0.0"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment