Skip to content

Commit 1181996

Browse files
authored
fix: Changing base image to wolfi, added node and npm (#266)
Changing base image to wolfi, added node and npm
1 parent feef341 commit 1181996

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

Dockerfile.development

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ RUN apk update && apk --no-cache add \
77
perl \
88
libsodium-dev
99

10-
1110
ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig
1211

1312
WORKDIR /usr/app
@@ -20,29 +19,32 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
2019
cargo install --root /usr/app --path . --debug --locked
2120

2221
# Setting up build directories
23-
FROM --platform=${BUILDPLATFORM} cgr.dev/chainguard/glibc-dynamic:latest-dev
22+
FROM --platform=${BUILDPLATFORM} cgr.dev/chainguard/wolfi-base
2423

2524
WORKDIR /app
2625

2726
COPY --from=base --chown=nonroot:nonroot /usr/app/bin/openzeppelin-relayer /app/openzeppelin-relayer
2827

2928
# Install plugin dependencies
3029
ARG TARGETARCH
31-
ENV NODE_VERSION=v20.19.2
30+
ARG NODE_VERSION=20.19
3231

3332
# Install Node.js
3433
USER root
35-
RUN apk add --no-cache curl && \
36-
curl -fsSL https://nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-linux-${TARGETARCH}.tar.xz \
37-
| tar -xJ --strip-components=1 -C /usr/local
34+
RUN apk add --no-cache nodejs=~${NODE_VERSION} npm
35+
3836
ENV PATH="/usr/local/bin:$PATH"
3937

4038
# Install pnpm and ts-node
4139
RUN npm install -g pnpm ts-node typescript
4240

41+
# removes apk and unneeded wolfi-base tools.
42+
RUN apk del wolfi-base apk-tools
43+
4344
# Copy plugins folder and install dependencies
44-
COPY ./plugins /app/plugins
45-
RUN chown -R nonroot:nonroot /app/plugins
45+
COPY --chown=nonroot:nonroot ./plugins /app/plugins
46+
47+
USER nonroot
4648
WORKDIR /app/plugins
4749
RUN pnpm install --frozen-lockfile
4850

Dockerfile.production

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
1515
cargo install --root /usr/app --path . --debug --locked
1616

1717
# Setting up build directories
18-
FROM --platform=${BUILDPLATFORM} cgr.dev/chainguard/glibc-dynamic:latest
18+
FROM --platform=${BUILDPLATFORM} cgr.dev/chainguard/wolfi-base
1919

2020
WORKDIR /app
2121
COPY --from=base --chown=nonroot:nonroot /usr/app/bin/openzeppelin-relayer /app/openzeppelin-relayer
@@ -24,28 +24,28 @@ COPY --from=base /usr/lib/libcrypto.so.3 /usr/lib/libcrypto.so.3
2424

2525
# Install plugin dependencies
2626
ARG TARGETARCH
27-
ENV NODE_VERSION=v20.19.2
27+
ARG NODE_VERSION=20.19
2828

2929
# Install Node.js
3030
USER root
31-
RUN apk add --no-cache curl && \
32-
curl -fsSL https://nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-linux-${TARGETARCH}.tar.xz \
33-
| tar -xJ --strip-components=1 -C /usr/local
31+
RUN apk add --no-cache nodejs=~${NODE_VERSION} npm
3432
ENV PATH="/usr/local/bin:$PATH"
3533

36-
# Install pnpm and ts-node
3734
RUN npm install -g pnpm ts-node typescript
3835

36+
# removes apk and unneeded wolfi-base tools.
37+
RUN apk del wolfi-base apk-tools
38+
3939
# Copy plugins folder and install dependencies
40-
COPY ./plugins /app/plugins
41-
RUN chown -R nonroot:nonroot /app/plugins
40+
COPY --chown=nonroot:nonroot ./plugins /app/plugins
41+
42+
USER nonroot
4243
WORKDIR /app/plugins
4344
RUN pnpm install --frozen-lockfile
4445

4546
# Return to app root
4647
WORKDIR /app
4748

48-
4949
ENV APP_PORT=8080
5050
ENV METRICS_PORT=8081
5151

0 commit comments

Comments
 (0)