Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WEB-INF/
70 changes: 70 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,15 @@
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>com.gwtplugins.gwt.eclipse.core.gwtNature</nature>
</natures>
<filteredResources>
<filter>
<id>1736624742049</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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;"]
82 changes: 82 additions & 0 deletions war/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Electronics Tools</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #1e1e1e;
color: #f5f5f5;
margin: 0;
padding: 0;
}
header {
background: #0d6efd;
color: white;
padding: 20px 0;
text-align: center;
}
header h1 {
margin: 0;
}
.container {
max-width: 900px;
margin: 20px auto;
padding: 20px;
}
.tool-list {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
}
.tool-item {
background-color: #292929;
border-radius: 8px;
padding: 15px;
width: 200px;
text-align: center;
box-shadow: 0 4px 6px rgba(0,0,0,0.3);
transition: 0.3s ease;
}
.tool-item:hover {
transform: translateY(-5px);
background-color: #383838;
}
.tool-item a {
color: #0d6efd;
text-decoration: none;
font-weight: bold;
}
.tool-item a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<header>
<h1>Electronics Tools</h1>
<p>Your one-stop destination for electronics calculations and simulators.</p>
</header>
<div class="container">
<div class="tool-list">
<div class="tool-item"><a target="_blank" href="about.html">About</a></div>
<div class="tool-item"><a target="_blank" href="blink-test.html">Blink Test</a></div>
<div class="tool-item"><a target="_blank" href="circuitjs.html">Circuit Simulator</a></div>
<div class="tool-item"><a target="_blank" href="crystal.html">Crystal Info</a></div>
<div class="tool-item"><a target="_blank" href="customfunction.html">Custom Function</a></div>
<div class="tool-item"><a target="_blank" href="customlogic.html">Custom Logic</a></div>
<div class="tool-item"><a target="_blank" href="customtransformer.html">Custom Transformer</a></div>
<div class="tool-item"><a target="_blank" href="diodecalc.html">Diode Calculator</a></div>
<div class="tool-item"><a target="_blank" href="iframe.html">IFrame Tool</a></div>
<div class="tool-item"><a target="_blank" href="lz-string.min.js">LZ-String Tool</a></div>
<div class="tool-item"><a target="_blank" href="mosfet-beta.html">MOSFET Beta</a></div>
<div class="tool-item"><a target="_blank" href="opampreal.html">OpAmp Real</a></div>
<div class="tool-item"><a target="_blank" href="shortrelay.php">Short Relay</a></div>
<div class="tool-item"><a target="_blank" href="subcircuits.html">Subcircuits</a></div>
</div>
</div>
</body>
</html>