Skip to content

Commit b55643c

Browse files
committed
Add a Docker image. Issue #1165
1 parent 3148e82 commit b55643c

File tree

9 files changed

+68
-6
lines changed

9 files changed

+68
-6
lines changed

.github/workflows/release-packages.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
ln -s contrib/debian debian
3030
sed -i 's/nvc (.*)/nvc (${{ env.VERSION }}-1)/' debian/changelog
31-
sudo apt-get build-dep .
31+
sudo apt-get -y build-dep .
3232
dpkg-buildpackage -uc -us -b
3333
mv ../nvc_${{ env.VERSION }}-1_amd64.deb nvc_${{ env.VERSION }}-1_amd64_${{ matrix.os }}.deb
3434
- name: 'Upload artifact'
@@ -49,3 +49,27 @@ jobs:
4949
fetch-depth: 0
5050
- name: Build MSI installer
5151
uses: ./.github/actions/windows-installer
52+
53+
docker:
54+
name: Docker image
55+
runs-on: ubuntu-24.04
56+
steps:
57+
- uses: actions/checkout@v3
58+
with:
59+
fetch-depth: 1
60+
- name: Build Docker image
61+
run: ./contrib/docker/build.sh
62+
- uses: actions/checkout@v4
63+
with:
64+
repository: nickg/vhdl-projects
65+
path: vhdl-projects
66+
fetch-depth: 1
67+
- name: Test
68+
run: |
69+
docker run --rm -v $(pwd)/vhdl-projects:/data \
70+
ghcr.io/nickg/nvc:latest /data/flopoco/test.sh
71+
- name: Push to ghcr.io
72+
run : |
73+
echo "${{ secrets.GHCR_TOKEN }}" | \
74+
docker login -u ${{ vars.GHCR_USER }} --password-stdin ghcr.io
75+
docker push ghcr.io/nickg/nvc:latest

NEWS.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Improved the formatting of the `--help` output.
2828
- The GitHub Action has been renamed from `nickg/setup-nvc-ci` to
2929
`nickg/setup-nvc`, although the old name should redirect to the new.
30+
- A Docker image was added at `ghcr.io/nickg/nvc` (#1165).
3031

3132
## Version 1.15.2 - 2025-03-01
3233
- Fixed invalid LLVM IR generation which could cause a crash with LLVM

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ with `winget install NickGasson.NVC`. Users of systems without existing
8888
packages should build from source.
8989

9090
For testing in GitHub Actions use
91-
[setup-nvc](https://github.com/marketplace/actions/setup-nvc).
91+
[setup-nvc](https://github.com/marketplace/actions/setup-nvc). There is
92+
also a Docker image
93+
[ghcr.io/nickg/nvc](https://github.com/nickg/nvc/pkgs/container/nvc) for
94+
other CI environments.
9295

9396
NVC has both a release branch and a development master branch. The
9497
master branch should be stable enough for day-to-day use and has

contrib/debian/control

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Section: misc
44
Priority: optional
55
Standards-Version: 3.9.2
66
Build-Depends: debhelper (>= 9), tcl-dev, llvm-dev, libreadline-dev,
7-
check, libzstd-dev, libdw-dev
7+
check, libzstd-dev, libdw-dev, libjansson-dev, flex, pkg-config, git
88

99
Package: nvc
1010
Architecture: any
11-
Depends: ${shlibs:Depends}, ${misc:Depends}
11+
Depends: ${shlibs:Depends}, ${misc:Depends}, binutils
1212
Description: VHDL compiler and simulator

contrib/debian/rules

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
override_dh_auto_configure:
66
dh_auto_configure --builddirectory=build/x-debian -- \
7-
--enable-tcl
7+
--enable-tcl --enable-server

contrib/docker/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM debian:bookworm AS build
2+
WORKDIR /src
3+
COPY . .
4+
RUN ln -s contrib/debian .
5+
ARG VERSION
6+
RUN sed -i "s/nvc (.*)/nvc ($VERSION-1)/" debian/changelog
7+
RUN apt-get -y update
8+
RUN apt-get -y build-dep .
9+
RUN DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -uc -us -b
10+
11+
FROM debian:bookworm
12+
RUN --mount=from=build,target=/src \
13+
apt-get -y update && \
14+
apt-get -y install /src/nvc_*.deb && \
15+
rm -rf /var/lib/apt/lists/*
16+
RUN nvc --version
17+
CMD ["/usr/bin/nvc"]
18+
LABEL org.opencontainers.image.source=https://github.com/nickg/nvc
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: fundamental -*-
2+
build/
3+
contrib/docker/
4+
.github/
5+
*~
6+
configure

contrib/docker/build.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -e -o pipefail
3+
4+
cd $(dirname ${BASH_SOURCE[0]})/../..
5+
6+
vers=$(sed -n '1s/AC_INIT(\[.*\], \[\([0-9\.]*\).*\].*/\1/p' configure.ac)
7+
8+
docker build -f contrib/docker/Dockerfile . \
9+
--build-arg VERSION=$vers \
10+
--tag ghcr.io/nickg/nvc:latest

test/test_vlog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ START_TEST(test_pp1)
381381
"\n"
382382
"pass\n"
383383
"\n"
384-
"../test/vlog/pp1.v\n"
384+
TESTDIR "/vlog/pp1.v\n"
385385
"16\n"
386386
"\n");
387387
}

0 commit comments

Comments
 (0)