forked from freeCodeCamp/euler-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (34 loc) · 1.31 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
FROM ubuntu
ARG USERNAME=camper
ARG HOMEDIR=/home/$USERNAME
ENV TZ="America/New_York"
RUN apt update && apt install -y sudo
# Unminimize Ubuntu to restore man pages
RUN yes | unminimize
# Set up timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Set up user, disable pw, and add to sudo group
RUN adduser --disabled-password \
--gecos '' ${USERNAME}
RUN adduser ${USERNAME} sudo
RUN sudo usermod -aG root ${USERNAME}
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> \
/etc/sudoers
# Install packages for projects - Docker for testing
RUN sudo apt-get install -y curl git bash-completion man-db docker wget build-essential
# Install Rust for this project
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install Node LTS
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
RUN sudo apt-get install -y nodejs
# /usr/lib/node_modules is owned by root, so this creates a folder ${USERNAME}
# can use for npm install --global
WORKDIR ${HOMEDIR}
RUN mkdir ~/.npm-global
RUN npm config set prefix '~/.npm-global'
# Configure course-specific environment
RUN mkdir curriculum
COPY ./ ./curriculum/
WORKDIR ${HOMEDIR}/curriculum
RUN cd .freeCodeCamp && cp sample.env .env && npm ci && cd ../ && npm ci && cargo install wasm-pack && npm run build