Skip to content

Commit

Permalink
Merge branch 'use-yarn-inside-of-docker' of https://github.com/Staffb…
Browse files Browse the repository at this point in the history
…ase/iframely-fork into Staffbase-use-yarn-inside-of-docker
  • Loading branch information
nleush committed Dec 4, 2020
2 parents ec94455 + 20a2ced commit e408480
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.git
.gitignore
# Ignore local node_modules because we fetch only production dependencies
# during the container build.
node_modules
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
FROM node:12.13.1-alpine
FROM node:12.18-alpine3.12

EXPOSE 8061

COPY . /iframely

WORKDIR /iframely

RUN apk add --no-cache git && \
npm install -g forever && \
npm install
# Create new non-root user
RUN addgroup -S iframelygroup && adduser -S iframely -G iframelygroup

# This will change the config to `config.<VALUE>.js` and the express server to change its behaviour.
# You should overwrite this on the CLI with `-e NODE_ENV=production`.
ENV NODE_ENV=local

## Utilize docker layer cache
COPY package.json yarn.lock /iframely/
RUN yarn install --pure-lockfile --production

COPY . /iframely

USER iframely

ENTRYPOINT [ "/iframely/docker/entrypoint.sh" ]
28 changes: 2 additions & 26 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
#!/bin/ash
#!/bin/sh

export ARGV="$@"
export ARGC="$#"

function sigterm_handler() {
echo "SIGTERM signal received."
forever stopall
}

trap "sigterm_handler; exit" TERM

function entrypoint() {
if [ "$ARGC" -eq 0 ]
then
# Run server in cluster mode by default
forever start cluster.js
else
# Use command line arguments supplied at runtime
forever start $ARGV
fi

forever --fifo logs 0 &
wait
}

entrypoint
exec node cluster.js

0 comments on commit e408480

Please sign in to comment.