-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·42 lines (31 loc) · 914 Bytes
/
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
### pi-like container image
### runme:
### cd reporoot
### docker build --tag pi-app .
### docker run --rm -it -p 80:80 pi-app
### (on host machine) ==> curl localhost/v1 ==> "hello, api"
FROM debian:stretch
# === start setup user
ENV USER pi
ENV HOME /home/$USER
# install sudo as root
RUN apt-get update && \
apt-get install -y sudo
# setup the $user
# -m ==> create home directory
# -U ==> create group with same name
RUN useradd -mU $USER
# add new user to sudoers
RUN adduser $USER sudo
# allow no password sudo execution
RUN echo "$USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER $USER
WORKDIR $HOME
# /=== end setup user
# from this point run as $USER, and . is /home/$USER
# COPY --chown does not expand env vars, so we fallback to calling chown manually
COPY . .
RUN sudo chown -R $USER:$USER .
RUN ./setup.sh
ENTRYPOINT ["./docker_entry.sh"]
CMD sudo tail -f /var/log/app/all.log