FROM crystallang/crystal:1.15.0-alpine AS builder WORKDIR /app RUN apk add --no-cache libssh2-dev libssh2-static openssl-dev openssl-libs-static zlib-dev zlib-static git openssh-client && \ mkdir -p ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts COPY . . RUN test -f .ssh/ssh-privatekey && cp .ssh/ssh-privatekey ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa || true RUN test -d lib || shards install RUN crystal build src/main.cr --release --static -o josie-health-core FROM alpine:3.18 RUN apk --no-cache add ca-certificates WORKDIR /app COPY --from=builder /app/josie-health-core . COPY --from=builder /app/openapi.yaml openapi.yaml COPY --from=builder /app/wagyuplush.jpg wagyuplush.jpg COPY --from=builder /app/static/ ./static/ RUN chown -R 1000:1000 /app && chmod -R 644 /app/static/* USER 1000:1000 EXPOSE 3001 CMD ["./josie-health-core"]