-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
60 lines (46 loc) · 1.92 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
## Dockerfile for the Aftok environment
FROM ubuntu:focal
MAINTAINER Kris Nuttycombe <[email protected]>
## ensure locale is set during build
ENV LANG C.UTF-8
ENV TZ America/Denver
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install build tools & library dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential autotools-dev autoconf dh-autoreconf \
g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg curl \
libpq-dev libsqlite3-dev libssl-dev \
libsecp256k1-dev pkg-config ca-certificates
RUN update-ca-certificates
ADD ./docker/install_stack.sh /root/
RUN /bin/sh /root/install_stack.sh
RUN /usr/local/bin/stack upgrade --force-download
# Install ghc globally so that we don't have to reinstall it
# whenever we change stack.yaml or aftok.cabal
ADD ./docker/global-stack.yaml /root/.stack/global-project/stack.yaml
RUN /root/.local/bin/stack --resolver lts-13.9 setup
# Globally install database migrations tool
RUN /root/.local/bin/stack install dbmigrations
RUN /root/.local/bin/stack install dbmigrations-postgresql
# Set up /etc/aftok volume for mounting configuration from the host system
RUN mkdir /etc/aftok
VOLUME ["/etc/aftok"]
ENV AFTOK_CFG /etc/aftok/aftok.cfg
# Install and build aftok-server dependencies
RUN mkdir -p /opt/aftok
WORKDIR /opt/aftok
ADD ./aftok.cabal /opt/aftok/aftok.cabal
ADD ./stack.yaml /opt/aftok/stack.yaml
# Build dependencies
RUN /root/.local/bin/stack setup
RUN /root/.local/bin/stack install cpphs
RUN /root/.local/bin/stack build --only-dependencies -j1
ADD ./lib /opt/aftok/lib
ADD ./daemon /opt/aftok/daemon
ADD ./server /opt/aftok/server
ADD ./test /opt/aftok/test
ADD ./migrations /opt/aftok/migrations
# build and install and aftok-server sources
RUN /root/.local/bin/stack install
ENTRYPOINT ["/opt/aftok/bin/aftok-server"]