go project - add a migration and rename the dockerfiles so that Go is the primary

This commit is contained in:
2026-08-06 15:54:40 -05:00
parent 459b90dcd7
commit e17fbc14a0
15 changed files with 771 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
# --- Build the Go API ---
FROM golang:1.26-alpine AS build
WORKDIR /src
COPY go/go.mod ./
COPY go/ ./
RUN CGO_ENABLED=0 go build -o /out/server ./cmd/server
# --- API runtime ---
FROM alpine:3.20 AS api
RUN apk add --no-cache curl
WORKDIR /app
COPY --from=build /out/server /app/server
COPY --from=build /src/devices.csv /app/devices.csv
EXPOSE 6733
HEALTHCHECK --interval=2s --timeout=2s --start-period=5s --retries=15 \
CMD curl -sf http://127.0.0.1:6733/healthz || exit 1
ENTRYPOINT ["/app/server"]
# --- Device simulator (writes results.txt into /output) ---
FROM alpine:3.20 AS simulator
COPY device-simulator-linux-arm64 /usr/local/bin/device-simulator
RUN chmod +x /usr/local/bin/device-simulator \
&& mkdir -p /output \
&& chmod 0777 /output
WORKDIR /output
VOLUME ["/output"]
ENTRYPOINT ["device-simulator"]