Skip to content

Commit e408480

Browse files
committed
Merge branch 'use-yarn-inside-of-docker' of https://github.com/Staffbase/iframely-fork into Staffbase-use-yarn-inside-of-docker
2 parents ec94455 + 20a2ced commit e408480

File tree

3 files changed

+19
-32
lines changed

3 files changed

+19
-32
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.git
22
.gitignore
3+
# Ignore local node_modules because we fetch only production dependencies
4+
# during the container build.
35
node_modules

Dockerfile

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
FROM node:12.13.1-alpine
1+
FROM node:12.18-alpine3.12
22

33
EXPOSE 8061
44

5-
COPY . /iframely
6-
75
WORKDIR /iframely
86

9-
RUN apk add --no-cache git && \
10-
npm install -g forever && \
11-
npm install
7+
# Create new non-root user
8+
RUN addgroup -S iframelygroup && adduser -S iframely -G iframelygroup
9+
10+
# This will change the config to `config.<VALUE>.js` and the express server to change its behaviour.
11+
# You should overwrite this on the CLI with `-e NODE_ENV=production`.
12+
ENV NODE_ENV=local
13+
14+
## Utilize docker layer cache
15+
COPY package.json yarn.lock /iframely/
16+
RUN yarn install --pure-lockfile --production
17+
18+
COPY . /iframely
19+
20+
USER iframely
1221

1322
ENTRYPOINT [ "/iframely/docker/entrypoint.sh" ]

docker/entrypoint.sh

+2-26
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
#!/bin/ash
1+
#!/bin/sh
22

3-
export ARGV="$@"
4-
export ARGC="$#"
5-
6-
function sigterm_handler() {
7-
echo "SIGTERM signal received."
8-
forever stopall
9-
}
10-
11-
trap "sigterm_handler; exit" TERM
12-
13-
function entrypoint() {
14-
if [ "$ARGC" -eq 0 ]
15-
then
16-
# Run server in cluster mode by default
17-
forever start cluster.js
18-
else
19-
# Use command line arguments supplied at runtime
20-
forever start $ARGV
21-
fi
22-
23-
forever --fifo logs 0 &
24-
wait
25-
}
26-
27-
entrypoint
3+
exec node cluster.js

0 commit comments

Comments
 (0)