Skip to content

Instantly share code, notes, and snippets.

@Cyclenerd
Last active September 1, 2025 14:10
Show Gist options
  • Select an option

  • Save Cyclenerd/d8934d5f570393eba377fae6cc6ed2de to your computer and use it in GitHub Desktop.

Select an option

Save Cyclenerd/d8934d5f570393eba377fae6cc6ed2de to your computer and use it in GitHub Desktop.
MeshCore Web Client Container
# Use the official Alpine Linux as a parent image
FROM docker.io/library/alpine:latest AS builder
# Define the URL for the MeshCore web client zip file
# The default version is v1.25.0, but this can be overridden at build time
# https://files.liamcottle.net/MeshCore/
ARG MESHCORE_WEB_URL="https://files.liamcottle.net/MeshCore/v1.25.0/MeshCore-v1.25.0+47-aef292a-web.zip"
# Install necessary packages
# curl is used to download the web client
# unzip is used to extract the zip file
RUN apk add curl unzip
# Set the working directory
WORKDIR /app
# Download and extract the MeshCore web client
RUN curl -L "$MESHCORE_WEB_URL" -o web.zip \
&& unzip -qq "web.zip"
# Use the https://static-web-server.net/ image to serve the static files
FROM ghcr.io/static-web-server/static-web-server:latest
# Expose port 8080 to allow external access to the web server
EXPOSE 8080
# Copy the extracted web client files from the builder stage to the public directory of the web server
COPY --from=builder /app/web/ /public
#!/usr/bin/env bash
# This script builds the MeshCore web client container image using Podman.
# Exit immediately if a command exits with a non-zero status.
set -e
# Define colors for better output readability
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check if Podman is installed on the system.
if ! command -v podman &> /dev/null;
then
echo -e "${RED}Error: Podman is not installed. Please install it to continue.${NC}" >&2
exit 1
fi
# Start the Podman machine if it is not already running.
if ! podman machine list --format "{{.Running}}" | grep -q "true";
then
echo -e "${YELLOW}Starting Podman machine...${NC}"
podman machine start
fi
# Build the container image using the Dockerfile in the current directory.
# The image is tagged as "meshcore-web-client".
# The platform is specified as "linux/amd64".
echo -e "${YELLOW}Building container image with Podman...${NC}"
podman build \
--platform "linux/amd64" \
-f Dockerfile -t meshcore-web-client .
# Export the container image to a tar file.
# This is useful for distributing the image without a container registry.
echo -e "${YELLOW}Exporting container image to meshcore-web-client.tar...${NC}"
podman save -o meshcore-web-client.tar meshcore-web-client
# Print a success message to indicate that the script has completed.
echo -e "${GREEN}Build script completed successfully.${NC}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment