-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
32 lines (28 loc) · 1.15 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
FROM golang:1.22-alpine3.19 AS builder
RUN apk add make
ARG BUILD_VERSION
ENV BUILD_VERSION=${BUILD_VERSION}
ADD --chown=1001:0 . /evmconnect
WORKDIR /evmconnect
RUN mkdir /.cache \
&& chgrp -R 0 /.cache \
&& chmod -R g+rwX /.cache
USER 1001
RUN make
# Copy the migrations from FFTM down into our local migrations directory
RUN DB_MIGRATIONS_DIR=$(go list -f '{{.Dir}}' github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi | sed 's|pkg/ffcapi|db|') \
&& cp -R $DB_MIGRATIONS_DIR db
FROM debian:buster-slim
WORKDIR /evmconnect
RUN chgrp -R 0 /evmconnect \
&& chmod -R g+rwX /evmconnect
RUN apt update -y \
&& apt install -y curl jq \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sL "https://github.com/golang-migrate/migrate/releases/download/$(curl -sL https://api.github.com/repos/golang-migrate/migrate/releases/latest | jq -r '.name')/migrate.linux-amd64.tar.gz" | tar xz \
&& chmod +x ./migrate \
&& mv ./migrate /usr/bin/migrate
COPY --from=builder --chown=1001:0 /evmconnect/firefly-evmconnect /usr/bin/evmconnect
COPY --from=builder --chown=1001:0 /evmconnect/db/ /evmconnect/db/
USER 1001
ENTRYPOINT [ "/usr/bin/evmconnect" ]