-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (49 loc) · 1.36 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM node:14-buster
MAINTAINER Florian Mäder <[email protected]>
# Limit Debian during build.
ARG DEBIAN_FRONTEND=noninteractive
# Set Node environment.
ENV NODE_ENV=production
# Default the timezone to Zürich.
ENV TZ=Europe/Zurich
# cowsay and fortune are installed into /usr/games/.
ENV PATH="/usr/games:${PATH}"
# Update system and install dependencies.
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
build-essential \
libicu-dev \
cowsay \
figlet \
fortunes && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install additional figlet fonts.
WORKDIR /usr/share/figlet
RUN curl -o contributed.tar.gz ftp://ftp.figlet.org/pub/figlet/fonts/contributed.tar.gz && \
tar --strip-components=1 -xzf contributed.tar.gz && \
rm contributed.tar.gz
# Create user account.
# https://askubuntu.com/a/94067
RUN adduser rxbot \
--disabled-password \
--disabled-login \
--gecos ""
# Switch working directory.
WORKDIR /home/rxbot
# Copy source code.
COPY app/ ./app/
COPY package.json package-lock.json* ./
# Set file permissions.
RUN chown -R rxbot:rxbot .
# Switch user.
USER rxbot
# Install dependencies.
# Development dependencies will not be installed
# because NODE_ENV is set to production.
RUN npm install
# Copy the configuration
# As most builds are because of the configuration, we add it last.
COPY config.json .
CMD ["npm", "start"]