Optimize dockerfile
This commit is contained in:
parent
f15bd58475
commit
3fd0631589
|
@ -1,21 +1,35 @@
|
|||
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
|
||||
|
||||
FROM node:lts-alpine3.15@sha256:a2c7f8ebdec79619fba306cec38150db44a45b48380d09603d3602139c5a5f92
|
||||
FROM node:lts-alpine3.15@sha256:a2c7f8ebdec79619fba306cec38150db44a45b48380d09603d3602139c5a5f92 as base
|
||||
|
||||
RUN mkdir -p /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add python3 \
|
||||
make \
|
||||
g++
|
||||
make \
|
||||
g++
|
||||
|
||||
COPY . .
|
||||
COPY package.json package.json
|
||||
COPY package-lock.json package-lock.json
|
||||
COPY tsconfig.json tsconfig.json
|
||||
COPY jestconfig.json jestconfig.json
|
||||
|
||||
FROM base as builder
|
||||
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci
|
||||
|
||||
COPY src src
|
||||
RUN npm run build && npm prune --production
|
||||
|
||||
FROM base as application
|
||||
|
||||
LABEL org.opencontainers.image.source="https://github.com/wormhole-foundation/wormhole/tree/dev.v2/relayer/spy_relayer#readme"
|
||||
|
||||
RUN npm ci && \
|
||||
npm run build
|
||||
COPY --from=builder /app/node_modules node_modules
|
||||
COPY --from=builder /app/lib lib
|
||||
|
||||
CMD [ "node", "lib/main.js" ]
|
||||
|
||||
#TODO don't hardcode for tilt but accept env file
|
||||
# RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
|
||||
|
|
|
@ -15,7 +15,8 @@ services:
|
|||
spy-relayer:
|
||||
build:
|
||||
context: .
|
||||
image: wormhole-relayer:latest
|
||||
target: application
|
||||
image: wormhole-relayer:dev.v2
|
||||
command: ${SPY_RELAYER_COMMAND:-npm run spy_relay}
|
||||
environment:
|
||||
- SPY_RELAY_CONFIG=/app/.env.docker.sample
|
||||
|
|
Loading…
Reference in New Issue