My application runs just fine from my laptop (OSX). I’m trying to build a docker image to run my app based on alpine (edge) linux. The application (a http server) builds fine and runs but crashes when trying to process a http response:
Unhandled exception in spawn(name: d7eb4036): Invalid encoding: utf-8 (ArgumentError) from /usr/lib/crystal/core/iconv.cr:29:35 in 'initialize' from /usr/lib/crystal/core/iconv.cr:9:3 in 'new' from /usr/lib/crystal/core/io/encoding.cr:61:16 in 'initialize' from /usr/lib/crystal/core/io/encoding.cr:60:5 in 'new' from /usr/lib/crystal/core/io.cr:496:7 in 'decoder' from /usr/lib/crystal/core/io.cr:545:10 in 'gets_to_end' from /usr/lib/crystal/core/http/client/response.cr:81:15 in 'consume_body_io' from /usr/lib/crystal/core/http/client/response.cr:105:9 in 'from_io?' from /usr/lib/crystal/core/http/client.cr:562:5 in 'exec_internal_single' from /usr/lib/crystal/core/http/client.cr:548:5 in 'exec_internal' from /usr/lib/crystal/core/http/client.cr:544:5 in 'exec' from /usr/lib/crystal/core/http/client.cr:666:5 in 'exec' from /usr/lib/crystal/core/http/client.cr:370:3 in 'post' :
I’m guessing I’m missing some libraries. Here’s the apk command from my Dockerfile:
RUN apk add --update --no-cache crystal shards musl-dev libressl-dev zlib-dev libpq sqlite-dev
I’m using alpine edge because I want the current version of crystal.
As an extra data point, if I build my docker image from crystallang/crystal rather than alpine:edge it runs without crashing.