Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add dockerfile for newest LTS builds #81

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Start from the Lambda Env mirror
FROM lambci/lambda:provided

# Switch to root, so we can install packages and configure users
USER root

# Install packages required for building GHC
RUN yum -y install gcc gmp-devel zlib-devel

# Give users access to /tmp, as stack uses it to build GHC
RUN chmod a=rwx,o+t /tmp

# Custom stack images require a stack group and stack user in the stack group
RUN /usr/sbin/groupadd stack
RUN /usr/sbin/useradd stack -g stack

# Switch to the stack user so we can setup its home directory
USER stack
RUN mkdir ~/.stack
ENV PATH=/usr/sbin:$HOME/.local/bin:$PATH
RUN mkdir -p ~/.local/bin

# Install stack
RUN curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

# Switch back to the root user
USER root

# Disable the default `lambdci/lambda` entrypoint
ENTRYPOINT []
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,17 @@ You'll need to either build on a compatible linux host or inside a compatible do
Note that current Stack LTS images are _not_ compatible.
If you see an error message that contains "version 'GLIBC_X.XX' not found" when running (hosted or locally), then your build environment is not compatible.

An example Dockerfile is included in this repo, which can build out later Stack LTS snapshots.
Build it with `docker -t ${BUILD_IMAGE_NAME} ${DOCKER_FILE_ROOT_DIR}`.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught by @samhh, this is missing build in the command.


Enable stack's docker integration and define an optional image within stack.yaml:

```yaml
# file: stack.yaml
docker:
enabled: true
# If omitted, this defaults to fpco/stack-build:lts-${YOUR_LTS_VERSION}
image: ${BUILD_IMAGE}
image: ${BUILD_IMAGE_NAME}
```

Don't forget to define your [CloudFormation] stack:
Expand Down