pin deps & cleanup

This commit is contained in:
Tanguy 2023-02-17 12:31:06 +01:00
parent 25e9ebb841
commit 585886a5cb
No known key found for this signature in database
GPG Key ID: 7DD8EC6B6CE6C45E
4 changed files with 34 additions and 22 deletions

View File

@ -1,13 +1,20 @@
ARG NimVersion="latest"
ARG NimVersion="1.6.10"
FROM nimlang/nim:${NimVersion}-alpine as builder
WORKDIR /app
COPY main.nimble .
RUN nim -v
RUN nimble install -dy
COPY nim-libp2p nim-libp2p
COPY main.nim .
RUN nim c -d:chronicles_log_level=WARN --threads:off main.nim
RUN \
cd nim-libp2p && \
nimble install_pinned
RUN \
cd nim-libp2p && \
nimble install "redis@#b341fe240dbf11c544011dd0e033d3c3acca56af"
COPY main.nim main.nim
RUN \
nim c --NimblePath:nim-libp2p/nimbledeps/pkgs -p:nim-libp2p -d:chronicles_log_level=WARN --threads:off main.nim
ENTRYPOINT ["/app/main"]

View File

@ -1,11 +1,29 @@
image_name := nim-v1.0
commitSha := 408dcf12bdf44dcd6f9021a6c795c472679d6d02
image.json: Dockerfile main.nim
all: image.json
image.json: main.nim nim-libp2p Dockerfile
IMAGE_NAME=${image_name} ../../dockerBuildWrapper.sh .
docker image inspect ${image_name} -f "{{.Id}}" | \
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
.PHONY: clean
main.nim: ../mainv1.nim
cp ../mainv1.nim main.nim
nim-libp2p: nim-libp2p-${commitSha}
rm -rf nim-libp2p
ln -s nim-libp2p-${commitSha} nim-libp2p
nim-libp2p-${commitSha}: nim-libp2p-${commitSha}.zip
unzip -o nim-libp2p-${commitSha}.zip
nim-libp2p-${commitSha}.zip:
wget -O $@ "https://github.com/status-im/nim-libp2p/archive/${commitSha}.zip"
.PHONY: clean all
clean:
rm image.json
rm -f main.nim
rm -f image.json
rm -rf nim-libp2p*

View File

@ -1,13 +0,0 @@
# Package
version = "0.1.0"
author = "The author"
description = "Demo for another package"
license = "MIT"
# Dependencies
requires "nim >= 1.2.2",
"libp2p == 1.0.0",
"redis == 0.4.0"