Skip to content

Commit

Permalink
Add Dockerfile
Browse files Browse the repository at this point in the history
- Add ability to run pretty-format-java inside this docker container
  • Loading branch information
mack1070101 committed Oct 23, 2020
1 parent 88ff37c commit 060d778
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
name: Google Java Formatter
description: Runs Google Java Formatter over Java source files
entry: pretty-format-java
language: python
language: docker
types: [java]
# this is needed because the hook downloads google-java-formatter and
# we don't have yet a nice way of ensuring a single download over multiple runs
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:18.04

# Make sure dependencies are installed
RUN apt-get update && apt-get install -y python3 python3-pip
RUN apt-get install -y python3-setuptools
RUN apt install -y default-jre
RUN pip3 install setuptools --upgrade

# Put the source files in the build container
COPY . /src/

# Set working directory to where we want to run install commands from
WORKDIR /src

# Install formattters to container
RUN python3 /src/setup.py install

# Configure environment variables into writeable directory
RUN mkdir -p /src/cache/.python-eggs
RUN chmod 777 /src/cache
ENV PYTHON_EGG_CACHE=/src/cache/.python-eggs
ENV PRE_COMMIT_HOME /src/cache

ENTRYPOINT /bin/bash

0 comments on commit 060d778

Please sign in to comment.