mirror of
https://github.com/l5yth/potato-mesh.git
synced 2026-05-09 23:04:56 +02:00
Compare commits
2 Commits
v0.2.1-rc0
...
v0.2.1-rc2
| Author | SHA1 | Date | |
|---|---|---|---|
| 89f0b1bcfe | |||
| e8af3b2397 |
+53
-38
@@ -1,49 +1,37 @@
|
||||
# Multi-stage build for PotatoMesh Data Ingestor
|
||||
FROM python:3.13-alpine AS builder
|
||||
# syntax=docker/dockerfile:1.6
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
musl-dev \
|
||||
linux-headers \
|
||||
build-base
|
||||
ARG TARGETOS=linux
|
||||
ARG PYTHON_VERSION=3.12.6
|
||||
|
||||
# Linux production image
|
||||
FROM python:${PYTHON_VERSION}-alpine AS production-linux
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY data/requirements.txt ./
|
||||
RUN pip install --no-cache-dir --user -r requirements.txt
|
||||
RUN set -eux; \
|
||||
apk add --no-cache \
|
||||
tzdata \
|
||||
curl; \
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
gcc \
|
||||
musl-dev \
|
||||
linux-headers \
|
||||
build-base; \
|
||||
python -m pip install --no-cache-dir -r requirements.txt; \
|
||||
apk del .build-deps
|
||||
|
||||
# Production stage
|
||||
FROM python:3.13-alpine AS production
|
||||
COPY data/ .
|
||||
RUN addgroup -S potatomesh && \
|
||||
adduser -S potatomesh -G potatomesh && \
|
||||
adduser potatomesh dialout && \
|
||||
chown -R potatomesh:potatomesh /app
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
tzdata \
|
||||
curl
|
||||
|
||||
# Create non-root user and add to dialout group for serial access
|
||||
RUN addgroup -g 1000 -S potatomesh && \
|
||||
adduser -u 1000 -S potatomesh -G potatomesh && \
|
||||
adduser potatomesh dialout
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy installed Python packages from builder stage
|
||||
COPY --from=builder /root/.local /home/potatomesh/.local
|
||||
|
||||
# Copy application code
|
||||
COPY --chown=potatomesh:potatomesh data/ .
|
||||
|
||||
# Switch to non-root user
|
||||
USER potatomesh
|
||||
|
||||
# Add local Python packages to PATH
|
||||
ENV PATH=/home/potatomesh/.local/bin:$PATH
|
||||
|
||||
# Default environment variables (can be overridden by host)
|
||||
ENV MESH_SERIAL=/dev/ttyACM0 \
|
||||
MESH_SNAPSHOT_SECS=60 \
|
||||
MESH_CHANNEL_INDEX=0 \
|
||||
@@ -51,5 +39,32 @@ ENV MESH_SERIAL=/dev/ttyACM0 \
|
||||
POTATOMESH_INSTANCE="" \
|
||||
API_TOKEN=""
|
||||
|
||||
# Start the mesh daemon
|
||||
CMD ["python", "mesh.py"]
|
||||
|
||||
# Windows production image
|
||||
FROM python:${PYTHON_VERSION}-windowsservercore-ltsc2022 AS production-windows
|
||||
|
||||
SHELL ["cmd", "/S", "/C"]
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY data/requirements.txt ./
|
||||
RUN python -m pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY data/ .
|
||||
|
||||
USER ContainerUser
|
||||
|
||||
ENV MESH_SERIAL=/dev/ttyACM0 \
|
||||
MESH_SNAPSHOT_SECS=60 \
|
||||
MESH_CHANNEL_INDEX=0 \
|
||||
DEBUG=0 \
|
||||
POTATOMESH_INSTANCE="" \
|
||||
API_TOKEN=""
|
||||
|
||||
CMD ["python", "mesh.py"]
|
||||
|
||||
FROM production-${TARGETOS} AS production
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
# Main application builder stage
|
||||
FROM ruby:3.4-alpine AS builder
|
||||
FROM ruby:3.3-alpine AS builder
|
||||
|
||||
# Install build dependencies and SQLite3
|
||||
RUN apk add --no-cache \
|
||||
@@ -19,7 +19,7 @@ RUN bundle config set --local without 'development test' && \
|
||||
bundle install --jobs=4 --retry=3
|
||||
|
||||
# Production stage
|
||||
FROM ruby:3.4-alpine AS production
|
||||
FROM ruby:3.3-alpine AS production
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
|
||||
Reference in New Issue
Block a user