forked from hasura/graphql-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (64 loc) · 3.63 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/codespaces-linux/.devcontainer/base.Dockerfile
FROM mcr.microsoft.com/vscode/devcontainers/universal:1-focal
ARG GHC=8.10.2
ARG CABAL=3.6.2.0
ARG POSTGRES_CLIENT_VERSION=13
# TODO: Run "debtree"/"apt-rdepends" or some other package-tree dep visualizer to find
# full deterministic deps (IE don't rely on implicit deps) and libs which are redundant/overlapping
#
# NOTE: $ apt-cache depends -i --recurse
# $ apt-cache dotty hello > dotfile
# $ dotty dotfile
#
# TODO: I think "libghc-pcre-light-dev" (or one of transitive GHC deps) installs an entire GHC 8.6.x
# Wtf?! Can we prevent this?
USER root
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y update \
&& apt-get install -y --no-install-recommends curl gnupg2 apt-transport-https \
# Postgres
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& curl -s https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
# MS-SQL 2017, Ubuntu 20.04
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list \
# Dependency libs
&& apt-get -y update \
&& apt-get install -y --no-install-recommends \
# TODO: Pull into apt-packages.dev.txt/apt-packages.runtime.txt, with explanations for each package
g++ gcc git gnupg libc6-dev libffi-dev libgmp-dev libkrb5-dev \
libpq-dev libssl-dev make netcat postgresql-client-${POSTGRES_CLIENT_VERSION} \
postgresql-client-common python3 python3-pip xz-utils zlib1g-dev \
unixodbc-dev freetds-dev \
default-libmysqlclient-dev libghc-pcre-light-dev \
&& ACCEPT_EULA=Y apt-get -y install msodbcsql17
# Add ghcup to PATH
# TODO: Check if this is even necessary. May be able to remove. It creates 2 extra image layers in Docker.
USER codespace
ENV PATH=${PATH}:${HOME}/.local/bin
ENV PATH=${PATH}:${HOME}/.ghcup/bin
# ghcup
#
# Main settings:
# * BOOTSTRAP_HASKELL_NONINTERACTIVE - any nonzero value for noninteractive installation
# * BOOTSTRAP_HASKELL_NO_UPGRADE - any nonzero value to not trigger the upgrade
# * BOOTSTRAP_HASKELL_MINIMAL - any nonzero value to only install ghcup
# * GHCUP_USE_XDG_DIRS - any nonzero value to respect The XDG Base Directory Specification
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
# * BOOTSTRAP_HASKELL_GHC_VERSION - the ghc version to install
# * BOOTSTRAP_HASKELL_CABAL_VERSION - the cabal version to install
# * BOOTSTRAP_HASKELL_INSTALL_STACK - whether to install latest stack
# * BOOTSTRAP_HASKELL_INSTALL_HLS - whether to install latest hls
# * BOOTSTRAP_HASKELL_ADJUST_BASHRC - whether to adjust PATH in bashrc (prepend)
# * BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG - whether to adjust mingw paths in cabal.config on windows
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_VERBOSE=1 \
BOOTSTRAP_HASKELL_INSTALL_HLS=1 \
BOOTSTRAP_HASKELL_ADJUST_BASHRC=1 \
BOOTSTRAP_HASKELL_GHC_VERSION=${GHC} BOOTSTRAP_HASKELL_CABAL_VERSION=${CABAL} \
sh
# Update Path to include Cabal and GHC exports
# TODO: Found this on StackOverflow answer -- unsure if it's required. Commented out for now.
#
# && echo "PATH=$HOME/.local/bin:$PATH" >> $HOME/.bashrc \
# && echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc