diff --git a/.dockerignore b/.dockerignore index 185fd7fde..34350adec 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,36 +1,15 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +.git +.gitignore -* -!Dockerfile -!python/ -python/** -!python/Dockerfile -!python/docker/ -!python/docker/** -!python/examples/ -!python/examples/** -!python/pyproject.toml -!python/setup.cfg -!python/README.md -!python/src/ -python/src/** -!python/src/pywy/ -!python/src/pywy/** -!wayang-assembly/ -wayang-assembly/** -!wayang-assembly/target/ -wayang-assembly/target/** -!wayang-assembly/target/*-dist.tar.gz +**/target/ + +.idea/ +.vscode/ +*.iml + +*.log + +.DS_Store +Thumbs.db + +.m2/ diff --git a/Dockerfile b/Dockerfile index b75a5b82c..95e9718fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,33 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM eclipse-temurin:17-jre AS wayang-assembler +FROM eclipse-temurin:17-jdk -ARG WAYANG_DIST=wayang-assembly/target/*-dist.tar.gz +WORKDIR /workspace/wayang -COPY ${WAYANG_DIST} /tmp/wayang-dist.tar.gz +RUN apt-get update \ + && apt-get install -y --no-install-recommends git bash \ + && rm -rf /var/lib/apt/lists/* -RUN mkdir -p /opt/wayang-root /opt/wayang /opt/wayang/smoke \ - && tar -xzf /tmp/wayang-dist.tar.gz -C /opt/wayang-root \ - && extracted_dir="$(find /opt/wayang-root -mindepth 1 -maxdepth 1 -type d -name 'wayang-*' | head -n 1)" \ - && test -n "${extracted_dir}" \ - && cp -a "${extracted_dir}/." /opt/wayang/ \ - && find /opt/wayang -type f \( -name "*-sources.jar" -o -name "*-javadoc.jar" -o -name "README.md" \) -delete \ - && printf "apache wayang docker smoke test\n" > /opt/wayang/smoke/wordcount.txt \ - && rm /tmp/wayang-dist.tar.gz +COPY . /workspace/wayang -FROM eclipse-temurin:17-jre +RUN sed -i 's/\r$//' mvnw \ + && chmod +x mvnw -ENV WAYANG_HOME=/opt/wayang -ENV FLAG_WAYANG=true -ENV PATH="${WAYANG_HOME}/bin:${PATH}" +COPY docker/entrypoint.sh /usr/local/bin/wayang-entrypoint -COPY --from=wayang-assembler /opt/wayang /opt/wayang +RUN chmod +x /usr/local/bin/wayang-entrypoint -RUN mkdir -p /root/.wayang /opt/wayang/conf \ - && touch /opt/wayang/conf/wayang.properties - -WORKDIR /opt/wayang - -ENTRYPOINT ["/opt/wayang/bin/wayang-submit"] -CMD ["org.apache.wayang.apps.pi.PiEstimation", "java", "1"] +ENTRYPOINT ["wayang-entrypoint"] +CMD ["bash"] \ No newline at end of file diff --git a/HACKATHON.md b/HACKATHON.md new file mode 100644 index 000000000..ce6e94045 --- /dev/null +++ b/HACKATHON.md @@ -0,0 +1,20 @@ +# Wayang Hackathon Development Environment + +This guide provides a Docker-based development environment for the Wayang +hackathon. + +The goal is to allow participants to get a working Wayang environment without +having to install Java, Maven, Spark, Hadoop, or other Wayang dependencies +locally. + +## Prerequisites + +Install: + +- Git +- Docker Desktop + +Verify Docker is available: + +```bash +docker --version \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 000000000..4f5da9f26 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,15 @@ +services: + wayang: + build: + context: . + dockerfile: Dockerfile + container_name: wayang-hackathon + working_dir: /workspace/wayang + volumes: + - .:/workspace/wayang + - wayang-maven-cache:/root/.m2 + stdin_open: true + tty: true + +volumes: + wayang-maven-cache: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 000000000..c4a15bb09 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e + +if [ -f /workspace/wayang/mvnw ]; then + sed -i 's/\r$//' /workspace/wayang/mvnw + chmod +x /workspace/wayang/mvnw +fi + +exec "$@" \ No newline at end of file