devcontainer server from scratch
This commit is contained in:
@@ -1,16 +1,30 @@
|
|||||||
FROM mcr.microsoft.com/openjdk/jdk:21-ubuntu
|
ARG VARIANT=21-jdk
|
||||||
|
FROM eclipse-temurin:${VARIANT}
|
||||||
|
|
||||||
# Set build arguments for username, UID, and GID
|
RUN apt-get update \
|
||||||
ARG USERNAME=java
|
&& apt-get -y install --no-install-recommends \
|
||||||
ARG USER_UID=1000
|
ca-certificates \
|
||||||
ARG USER_GID=1000
|
git \
|
||||||
|
nano \
|
||||||
|
vim-tiny \
|
||||||
|
&& apt-get auto-remove -y \
|
||||||
|
&& apt-get clean -y \
|
||||||
|
&& chsh -s $(which bash) ubuntu \
|
||||||
|
&& echo 'export PS1="\e[01;32m\u\e[m:\e[01;34m\w\e[m\$ "' >> /home/ubuntu/.bashrc
|
||||||
|
|
||||||
# Create the user and group with the specified UID and GID
|
ENV MAVEN_HOME=/opt/maven
|
||||||
RUN groupadd --gid $USER_GID $USERNAME \
|
ENV PATH=$MAVEN_HOME/bin:$PATH
|
||||||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
|
|
||||||
|
ARG MAVEN_VERSION=3.9.10
|
||||||
|
ARG BASE_URL=https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
|
||||||
|
|
||||||
|
RUN mkdir -p $MAVEN_HOME \
|
||||||
|
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
|
||||||
|
&& tar -xzf /tmp/apache-maven.tar.gz -C $MAVEN_HOME --strip-components=1 \
|
||||||
|
&& rm -f /tmp/apache-maven.tar.gz
|
||||||
|
|
||||||
# Set the default user
|
# Set the default user
|
||||||
USER $USERNAME
|
USER ubuntu
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /home/$USERNAME
|
WORKDIR /home/ubuntu
|
||||||
|
|||||||
@@ -3,12 +3,6 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"dockerfile": "Dockerfile",
|
"dockerfile": "Dockerfile",
|
||||||
},
|
},
|
||||||
"features": {
|
|
||||||
"ghcr.io/devcontainers/features/java:1": {
|
|
||||||
"installMaven": "true"
|
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/git:1": {}
|
|
||||||
},
|
|
||||||
"containerEnv": {
|
"containerEnv": {
|
||||||
"GIT_REPO_URL": "https://scm.vilanet.fr/kriss/slot"
|
"GIT_REPO_URL": "https://scm.vilanet.fr/kriss/slot"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user