-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (49 loc) · 2.01 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (49 loc) · 2.01 KB
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
FROM ubuntu:focal
# receive build-arguments
ARG GH_TOKEN
ARG username
ARG email
# set GH_TOKEN as env variable
ENV GH_TOKEN=${GH_TOKEN}
# apt update
RUN apt update
# install zsh
RUN apt install zsh -y
# install ohmyzsh and set to default shell
RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# install java
RUN apt install openjdk-17-jdk -y
RUN apt install openjdk-17-jre -y
# install git
RUN apt update -y && apt install git -y
# install gpg
RUN apt update -y && apt install gpg -y
# install curl
RUN type -p curl >/dev/null || apt install curl -y
# install kubectl
RUN curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | dd of=/usr/share/keyrings/kubernetes-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/kubernetes-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | tee /etc/apt/sources.list.d/kubernetes.list > /dev/null \
&& apt update \
&& apt install kubectl -y
# add autocompletion of kubectl to zsh
RUN echo "# add autocompletion of kubectl to zsh"
RUN echo "source <(kubectl completion zsh)" >> ~/.zshrc
# install GitHub CLI (gh)
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y
# clone repo
RUN gh repo clone philippabele/java-masterclass
# configure git to use GitHub CLI as a credential helper
RUN gh auth setup-git
# setup git
WORKDIR /java-masterclass
RUN git config gpg.program gpg
# RUN git config commit.gpgsign true
RUN git config user.name "${username}"
RUN git config user.email "${email}"
# Set entrypoint
CMD ["bash"]