Skip to content

Commit 1b0e1f2

Browse files
committed
build it another way
1 parent 2b3b24e commit 1b0e1f2

12 files changed

Lines changed: 32 additions & 611 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
FROM golang:1.26.1-bookworm AS build
2+
RUN apt-get update && apt-get install -y \
3+
jq \
4+
&& apt-get clean \
5+
&& rm -rf /var/lib/apt/lists/*
6+
COPY scripts/install_cosign.sh /tmp/install_cosign.sh
7+
COPY scripts/install_trivy.sh /tmp/install_trivy.sh
8+
RUN INSTALL_DIR=/usr/local/bin /tmp/install_cosign.sh
9+
RUN INSTALL_DIR=/tmp/trivy_arm64 ARCH=ARM64 /tmp/install_trivy.sh
10+
RUN INSTALL_DIR=/tmp/trivy_amd64 ARCH=64bit /tmp/install_trivy.sh
11+
112
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
213
ARG TARGETARCH
314
ENV TARGETARCH=${TARGETARCH}
@@ -63,7 +74,7 @@ RUN git clone https://github.com/awslabs/git-secrets.git /tmp/git-secrets && \
6374
mkdir -p /usr/share/secrets-scanner && \
6475
chmod 755 /usr/share/secrets-scanner && \
6576
curl -L https://raw.githubusercontent.com/NHSDigital/software-engineering-quality-framework/main/tools/nhsd-git-secrets/nhsd-rules-deny.txt -o /usr/share/secrets-scanner/nhsd-rules-deny.txt
66-
77+
COPY --from=build /tmp/trivy_amd64/trivy /usr/local/bin/trivy
6778
USER vscode
6879

6980
ENV PATH="/home/vscode/.asdf/shims:/home/vscode/.local/bin:$PATH:/workspaces/eps-devcontainers/node_modules/.bin"
@@ -83,9 +94,7 @@ RUN asdf plugin add python; \
8394
asdf plugin add actionlint; \
8495
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git; \
8596
asdf plugin add trivy https://github.com/zufardhiyaulhaq/asdf-trivy.git; \
86-
asdf plugin add yq https://github.com/sudermanjr/asdf-yq.git; \
87-
asdf plugin add golang
88-
97+
asdf plugin add yq https://github.com/sudermanjr/asdf-yq.git;
8998

9099
WORKDIR /workspaces/eps-devcontainers
91100
COPY .tool-versions /workspaces/eps-devcontainers/.tool-versions
@@ -95,10 +104,5 @@ COPY .tool-versions /home/vscode/.tool-versions
95104
RUN asdf install python; \
96105
asdf install
97106

98-
COPY scripts/install_cosign.sh /tmp/install_cosign.sh
99-
COPY scripts/install_trivy.sh /tmp/install_trivy.sh
100-
RUN INSTALL_DIR=/home/vscode/.local/bin /tmp/install_cosign.sh
101-
RUN INSTALL_DIR=/home/vscode/.local/bin /tmp/install_trivy.sh
102-
103107
RUN git-secrets --register-aws --global && \
104108
git-secrets --add-provider --global -- cat /usr/share/secrets-scanner/nhsd-rules-deny.txt

.devcontainer/Dockerfile.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM golang:1.26.1-bookworm
2+
RUN apt-get update && apt-get install -y \
3+
jq \
4+
&& apt-get clean \
5+
&& rm -rf /var/lib/apt/lists/*
6+
COPY scripts/install_cosign.sh /tmp/install_cosign.sh
7+
COPY scripts/install_trivy.sh /tmp/install_trivy.sh
8+
RUN INSTALL_DIR=/usr/local/bin /tmp/install_cosign.sh
9+
RUN INSTALL_DIR=trivy_arm64 ARCH=ARM64 /tmp/install_trivy.sh
10+
RUN INSTALL_DIR=trivy_amd64 ARCH=64bit /tmp/install_trivy.sh

.github/workflows/build_all_images.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ jobs:
6464
6565
package_base_docker_image:
6666
uses: ./.github/workflows/build_multi_arch_image.yml
67+
needs: [
68+
download_trivy
69+
]
6770
with:
6871
tag_latest: ${{ inputs.tag_latest }}
6972
docker_tag: ${{ inputs.docker_tag }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ src/base/.devcontainer/language_versions/
44
.trivyignore_combined.yaml
55
.out/
66
.envrc
7+
.trivy_out/

.tool-versions

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ direnv 2.37.1
66
actionlint 1.7.10
77
ruby 3.3.0
88
yq 4.52.2
9-
golang 1.24.13

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
CONTAINER_PREFIX=ghcr.io/nhsdigital/eps-devcontainers/
2+
include src/base/.devcontainer/Mk/build.mk
3+
include src/base/.devcontainer/Mk/check.mk
4+
include src/base/.devcontainer/Mk/trivy.mk
5+
include src/base/.devcontainer/Mk/credentials.mk
26

37
ifeq ($(strip $(NO_CACHE)),true)
48
NO_CACHE_FLAG=--no-cache

contrib/asff.tpl

Lines changed: 0 additions & 161 deletions
This file was deleted.

contrib/gitlab-codequality.tpl

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)