-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
43 lines (32 loc) · 966 Bytes
/
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
# Build
FROM quay.io/benz0li/ghc-musl:9.6.6 AS build
WORKDIR /usr/src/app
# Install upx
RUN apk update && apk add --no-cache upx
# Copy only the necessary files for dependency installation
COPY hapistrano.cabal ./
# Install dependencies
RUN cabal update && \
cabal build --only-dependencies --enable-static
# Copy the rest of the files.
COPY . .
# Build the application and compress the binary
RUN cabal build --enable-executable-static && \
cp $(cabal exec which hap) hap && \
upx hap
# Final image
FROM alpine:3.15
LABEL maintainer="Cristhian Motoche <cmotoche@stackbuilders.com>"
# Install runtime dependencies
RUN apk update && \
apk add --no-cache \
ca-certificates \
git \
openssh-client
# Create .ssh directory
RUN mkdir -p ~/.ssh
# Copy the binary from the build stage
COPY --from=build /usr/src/app/hap /usr/local/bin/hap
# Set the entrypoint and default command
ENTRYPOINT ["/usr/local/bin/hap"]
CMD ["--help"]