Skip to content

Commit c2cdf69

Browse files
Use entrypoint for docker
1 parent 4136822 commit c2cdf69

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

docker/image-snap-sync/Dockerfile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ ENV LANGUAGE=en_US.UTF-8
1010
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
1111
RUN apt-get update
1212
RUN apt-get upgrade -y
13-
RUN apt-get install -y curl tmux nano net-tools procps htop git build-essential cmake pkg-config libssl-dev sudo
13+
RUN apt-get install -y curl tmux nano net-tools procps htop git build-essential cmake pkg-config libssl-dev gosu
14+
15+
COPY entrypoint.sh /usr/local/bin/
16+
RUN chmod +x /usr/local/bin/entrypoint.sh
1417

1518
RUN groupadd --gid 10246 runner
1619
RUN useradd --gid 10246 --uid 10246 -m runner
@@ -30,16 +33,6 @@ RUN cd /home/runner/frigate-snap-sync/
3033
WORKDIR /home/runner/frigate-snap-sync/
3134
RUN (cargo update && cargo build --release --all) || (git checkout Cargo.lock && cargo build --release --all --locked)
3235

33-
USER root
34-
35-
RUN echo "" >> /etc/sudoers
36-
RUN echo "runner ALL=(ALL) NOPASSWD: /usr/bin/apt-get update" >> /etc/sudoers
37-
RUN echo "runner ALL=(ALL) NOPASSWD: /usr/bin/apt-get clean" >> /etc/sudoers
38-
RUN echo "runner ALL=(ALL) NOPASSWD: /usr/bin/apt-get upgrade -y" >> /etc/sudoers
39-
RUN echo "runner ALL=(ALL) NOPASSWD: /usr/bin/apt-file update" >> /etc/sudoers
40-
41-
USER runner
42-
4336
RUN mkdir /home/runner/app/
4437
RUN cp /home/runner/frigate-snap-sync/target/release/snap-sync /home/runner/app/
4538
RUN cd /home/runner/app/
@@ -50,4 +43,7 @@ RUN rm -rf /home/runner/frigate-snap-sync/
5043
RUN rm -rf /home/runner/.rustup/
5144
RUN rm -rf /home/runner/.cargo/
5245

53-
CMD sudo apt-get update && sudo apt-get upgrade -y && /home/runner/app/snap-sync start -c /config.yaml
46+
USER root
47+
48+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
49+
CMD /home/runner/app/snap-sync start -c /config.yaml
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
4+
# Do updates
5+
apt-get update
6+
apt-get -y upgrade
7+
apt-get clean
8+
rm -rf /var/lib/apt/lists/*
9+
10+
# Drop privileges
11+
exec gosu runner:runner "$@"

0 commit comments

Comments
 (0)