-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
56 lines (43 loc) · 1.69 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
# Creates a Docker container for BitShovel service
# IMAGE BUILD COMMANDS
FROM ubuntu:18.04
LABEL maintainer="dfoderick@gmail.com"
# Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg
# Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
# Create the user 'myuser' and add them to the sudo group.
RUN useradd -ms /bin/bash myuser
RUN adduser myuser sudo
# Set password to 'password' change value below if you want a different password
RUN echo myuser:password | chpasswd
# Set the working directory to be the users home directory
WORKDIR /home/myuser
# Setup NPM for non-root global install
# This fixes the most common conflicts between Mac and Linux development environments.
RUN mkdir /home/myuser/.npm-global
RUN chown -R myuser .npm-global
RUN echo "export PATH=~/.npm-global/bin:$PATH" >> /home/myuser/.profile
RUN runuser -l myuser -c "npm config set prefix '~/.npm-global'"
# Expose the port the API will be served on.
#EXPOSE 3000
# Switch to user account.
USER myuser
# Prep 'sudo' commands.
RUN echo 'password' | sudo -S pwd
# Clone the repository
WORKDIR /home/myuser
RUN git clone https://github.com/dfoderick/bitshovel
WORKDIR /home/myuser/bitshovel
# Install dependencies
RUN npm install
# Start the application.
COPY bitshovel-production bitshovel-production
CMD ["./bitshovel-production"]
#Dummy app just to get the container running without exiting, for debugging.
#You can then enter the container with command: docker exec -it <container ID> /bin/bash
#COPY dummyapp.js dummyapp.js
#CMD ["node", "dummyapp.js"]