Skip to content

Commit

Permalink
Run in alpine with glibc/gmp and a proper locale
Browse files Browse the repository at this point in the history
The hGetContents exception which we tried to fix by setting LANG was not
actually fixed. I believe this is because busybux ships with no locale
support and so setting LANG had no effect.

To fix this, I first moved to alpine which is quickly replacing busybox
as the go-to runtime docker base image. The fix then required
installation of an alternate glibc package to define the locale and
allowed for installation of the gmp package instead of copying the
library manually.

The image size increases from ~26MB to ~56MB with this change.
  • Loading branch information
pbrisbin committed Mar 22, 2016
1 parent a96fec1 commit 267cef7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 1 addition & 6 deletions Makefile
Expand Up @@ -12,11 +12,6 @@ build:
--tag $(IMAGE_NAME)-build \
--file $(PWD)/docker/Build.plan .

.local/libgmp.so.10: build
docker run --rm \
--volume $(PWD)/.local:/root/.local \
$(IMAGE_NAME)-build cp /usr/lib/x86_64-linux-gnu/libgmp.so.10 /root/.local

.local/bin/codeclimate-shellcheck: build
docker run --rm \
--volume $(PWD)/.local/bin:/root/.local/bin \
Expand All @@ -29,7 +24,7 @@ compress: .local/bin/codeclimate-shellcheck
--volume $(PWD)/.local/bin:/data \
lalyos/upx codeclimate-shellcheck

image: .local/libgmp.so.10 .local/bin/codeclimate-shellcheck data/env.yml
image: .local/bin/codeclimate-shellcheck data/env.yml
docker build \
--tag $(IMAGE_NAME) \
--file $(PWD)/docker/Release.plan .
12 changes: 9 additions & 3 deletions docker/Release.plan
@@ -1,9 +1,15 @@
FROM progrium/busybox
FROM alpine:3.3
MAINTAINER Philip Cunningham <hello@filib.io>

ENV LANG en_US.UTF-8
ADD docker/files/ .
RUN apk --allow-untrusted --update add \
glibc-2.23-r1.apk \
glibc-bin-2.23-r1.apk \
glibc-i18n-2.23-r1.apk \
gmp && \
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8

ADD .local/libgmp.so.10 /usr/lib/libgmp.so.10
ENV LANG en_US.UTF-8

RUN adduser -u 9000 -h /home/app -D app
USER app
Expand Down

0 comments on commit 267cef7

Please sign in to comment.