-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a dummy nodeJS app * Enable dependabot Signed-off-by: Benoit Donneaux <[email protected]>
- Loading branch information
Showing
9 changed files
with
817 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules | ||
/.npm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.