Skip to content

Commit

Permalink
Test dependabot (#32)
Browse files Browse the repository at this point in the history
* Add a dummy nodeJS app
* Enable dependabot

Signed-off-by: Benoit Donneaux <[email protected]>
  • Loading branch information
btlogy authored Jan 23, 2023
1 parent 4622f98 commit 9fd5579
Show file tree
Hide file tree
Showing 9 changed files with 817 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 2
updates:
# Keep npm dependencies up to date
- package-ecosystem: npm
directory: "/"
schedule:
interval: "daily"
time: "13:00"
# Raise all npm pull requests with reviewers
reviewers:
- "btlogy"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
/.npm

29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3'
services:
nodejs:
#image: node:current-alpine
build:
context: docker/nodejs
dockerfile: Dockerfile
args:
uid: "${_UID:-1000}"
gid: "${_GID:-1000}"
volumes:
- .:/var/tmp/nodejs
working_dir: /var/tmp/nodejs
stdin_open: true
tty: true
hostname: nodejs.local
container_name: nodejs.local
command: sh
networks:
- bridge
deploy:
resources:
limits:
cpus: '1.5'
memory: 256M

networks:
bridge:
external: true
59 changes: 59 additions & 0 deletions docker/nodejs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
##############################
# General level requirements #
##############################

# Pull base image from official repo
FROM node:19.4.0-alpine3.17

# Prepare locales
ARG locale=en_US.UTF-8
ENV LANG "${locale}"
ENV LC_ALL "${locale}"

# Configure desired timezone
ENV TZ=Europe/Amsterdam
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone

##################################
# Application level requirements #
##################################

# Update npm which tend to evolve from the base image
ENV NPM_VERSION 9.3.1
RUN npm install -g npm@$NPM_VERSION

###########################
# User level requirements #
###########################

# Parameters for default user:group
ARG uid=1000
ARG user=node
ARG gid=1000
ARG group=node

# Add user and group for build and runtime
RUN id ${user} > /dev/null 2>&1 || \
{ addgroup -g "${gid}" "${group}" && adduser -D -h /home/${user} -s /bin/bash -G "${group}" -u "${uid}" "${user}"; }

# Copy requirements in non-root user home directory
COPY package.json package-lock.json "/home/${user}/"
RUN chown "${user}:${group}" "/home/${user}/package.json" "/home/${user}/package-lock.json"

# Switch to non-root user
USER ${user}
WORKDIR /home/${user}

# Prepare user variables
ENV USER ${user}
ENV HOME=/home/${user}

# Install required packages
RUN npm clean-install && \
npm cache clean --force 2> /dev/null

# Adapt paths for NodeJS
ENV NPM_CONFIG_PREFIX=/home/nodejs
ENV NODE_PATH=/home/nodejs/node_modules:/usr/local/lib/node_modules
ENV PATH=/home/nodejs/node_modules/.bin:$PATH
Loading

0 comments on commit 9fd5579

Please sign in to comment.