Skip to content

Commit e8a619a

Browse files
committed
feat: add dockerfile
1 parent e8aaaa4 commit e8a619a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (C) 2021 Edge Network Technologies Limited
2+
# Use of this source code is governed by a GNU GPL-style license
3+
# that can be found in the LICENSE.md file. All rights reserved.
4+
5+
FROM node:lts AS build
6+
RUN npm install -g pkg-fetch
7+
8+
# Configure, download target Node base binary
9+
ARG targetNode=node16
10+
ARG targetPlatform=alpine
11+
ARG targetArch=x64
12+
RUN pkg-fetch -n ${targetNode} -p ${targetPlatform} -a ${targetArch}
13+
14+
WORKDIR /build
15+
16+
# Install dependencies
17+
COPY package*.json ./
18+
RUN npm install
19+
20+
# Copy and transpile app src
21+
COPY src ./src
22+
COPY tsconfig.json ./
23+
RUN npm run build:src
24+
25+
# Package binary
26+
RUN npx pkg . \
27+
--target $targetNode-$targetPlatform-$targetArch \
28+
--output bin/faucet
29+
30+
# Copy binary to clean alpine image
31+
FROM alpine:latest
32+
COPY --from=build /build/bin/faucet /usr/local/bin/faucet
33+
34+
ENTRYPOINT ["faucet"]
35+
CMD [""]

0 commit comments

Comments
 (0)