Skip to content

Commit 173383c

Browse files
Wrap to container, minor improvements
1 parent a5c5320 commit 173383c

File tree

7 files changed

+196
-128
lines changed

7 files changed

+196
-128
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*
2+
!src
3+
!config.js
4+
!LICENSE
5+
!package.json
6+
!package-lock.json
7+
!readme.md

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Build node_modules to avoid installing NPM (additinal container size)
2+
3+
FROM alpine AS stage
4+
5+
WORKDIR /app
6+
COPY . /app
7+
8+
RUN apk add --update npm=12.15.0-r1
9+
RUN npm install
10+
11+
# Build aclual container
12+
13+
FROM alpine
14+
15+
COPY . /app
16+
COPY --from=stage /app/node_modules /app/node_modules
17+
WORKDIR /app
18+
19+
RUN apk add --update nodejs=12.15.0-r1
20+
21+
EXPOSE 80
22+
23+
ENV APP__ENV_NAME=prod
24+
CMD node -r esm src/api.js

build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
HUB=zitros/analytics-saviour
4+
5+
docker build --rm -t image .
6+
7+
if [ $# -eq 1 ]
8+
then
9+
docker tag image $HUB:$1
10+
fi
11+
docker tag image $HUB:latest
12+
13+
docker push $HUB

0 commit comments

Comments
 (0)