diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..7ce98a21e --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +WEB-INF/ \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..9e1d799b5 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,70 @@ +name: Build and Deploy CircuitJS1 Docker Image +on: + push: + branches: + - master + pull_request: + branches: + - master +env: + REGISTRY: ghcr.io + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + # Step 1: Check out the repository + - name: Check out code + uses: actions/checkout@v4 + + # Step 2: Set up Java for GWT build + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: "temurin" + java-version: "8" + + # Step 3: Install GWT and dependencies + - name: Install GWT + run: | + sudo apt-get update && sudo apt-get install -y unzip + wget https://github.com/gwtproject/gwt/releases/download/2.10.0/gwt-2.10.0.zip + unzip gwt-2.10.0.zip -d $HOME + echo "GWT installed." + + # Step 4: Build the CircuitJS1 application using GWT + - name: Compile with GWT + run: | + export GWT_HOME=$HOME/gwt-2.10.0 + # Ensure the src/ directory is included in the classpath + java -cp "$GWT_HOME/gwt-dev.jar:$GWT_HOME/gwt-user.jar:./src" com.google.gwt.dev.Compiler -war war com.lushprojects.circuitjs1.circuitjs1 + + # Step 5: Package the GWT build artifacts (optional for debugging) + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: circuitjs1-war + path: war + + # Step 6: Log in to GitHub Container Registry (GHCR) + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + # Step 7: Build and Push the Docker image + - name: Build and push Backend Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile + push: true + tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/circuitjs1:${{ github.ref_name }} + env: + ADC_VERSION: ${{ github.ref_name }} diff --git a/.project b/.project index d55af456a..a6924969b 100644 --- a/.project +++ b/.project @@ -42,4 +42,15 @@ org.eclipse.wst.common.project.facet.core.nature com.gwtplugins.gwt.eclipse.core.gwtNature + + + 1736624742049 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..bdcd7acf2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Base Nginx image +FROM nginx:stable-alpine + +# Set a directory in the container for static files +WORKDIR /usr/share/nginx/html + +# Copy the pre-compiled WAR artifacts (static files) into the container +COPY war/ . + +# Expose port 80 for incoming HTTP traffic +EXPOSE 80 + +# Start the Nginx server in the foreground +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/war/index.html b/war/index.html new file mode 100644 index 000000000..d3c7bf7ae --- /dev/null +++ b/war/index.html @@ -0,0 +1,82 @@ + + + + + + Electronics Tools + + + +
+

Electronics Tools

+

Your one-stop destination for electronics calculations and simulators.

+
+
+
+ + + + + + + + + + + + + + +
+
+ + \ No newline at end of file