From d1e81872dab9c8152bcf39addaf269f00f2383d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20S=C3=B6derberg?= Date: Wed, 19 Feb 2025 19:01:39 +0100 Subject: [PATCH] first commit --- .github/workflows/docker-build-push.yml | 67 +++++++++++++++++++++++++ Dockerfile | 62 +++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 .github/workflows/docker-build-push.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 0000000..a9a7093 --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -0,0 +1,67 @@ +name: Docker Push & Push + +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + push: + branches: + - 'master' + - 'testing' + paths-ignore: + - 'README.md' + - 'docker-compose.yml' + # Rebuild monthly to keep packages up to date + schedule: + - cron: '0 0 1 * *' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + uses: actions/checkout@v4 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to DockerHub + uses: docker/login-action@v3 + if: github.repository_owner == 'Swedish-Wiking' + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Docker Metadata + id: docker-meta + uses: docker/metadata-action@v5 + with: + images: swedishwiking/docker-wireguard-pia-python + tags: | + # Tag branches with branch name, but disable for default branch + type=ref,event=branch,enable=${{ github.ref_name != 'master' }} + # set latest tag for default branch + type=raw,value=latest,enable=${{ github.ref_name == 'master' }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64,linux/arm,linux/arm64 + push: ${{ github.repository_owner == 'Swedish-Wiking' }} + tags: ${{ steps.docker-meta.outputs.tags }} + labels: ${{ steps.docker-meta.outputs.labels }} + - + name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fdde411 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,62 @@ +FROM ubuntu:latest + +# Updates and installs commons +RUN apt-get update \ + && apt-get install -y \ + curl \ + git \ + sudo \ + vim \ + wget \ + locales + +# Install Python +RUN apt-get install -y \ + python3 \ + python3-tk \ + python-is-python3 + +# Install JAVA +RUN apt-get install -y \ + default-jdk \ + openjdk-21-source + +# Install Scala +ARG SCALA_VERSION="3.6.3" +ARG URL="https://github.com/scala/scala3/releases/download/${SCALA_VERSION}/scala3-${SCALA_VERSION}.tar.gz" +ARG SCALA_DIR="/usr/share/scala3-${SCALA_VERSION}" +RUN curl -fsL --show-error ${URL} | tar xfz - -C /usr/share && \ + mv ${SCALA_DIR} /usr/share/scala && \ + chown -R root:root /usr/share/scala && \ + chmod -R 755 /usr/share/scala && \ + ln -s /usr/share/scala/bin/* /usr/local/bin + +# Install R +RUN apt-get install -y \ + r-base \ + build-essential \ + libcurl4-openssl-dev \ + libssl-dev \ + libxml2-dev \ + libfontconfig1-dev + # && Rscript -e 'install.packages(c("languageserver", "ggplot2", "reshape2", "httpgd"))' + +# Install TeX-live +# RUN apt-get install -y texlive-full + +# Clears apt lists +RUN rm -rf /var/lib/apt/lists/* + +# Sets local +RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +ENV LANG=en_US.utf8 + +# Adds the default User +ARG USER=lth-student +RUN useradd --groups sudo --no-create-home --shell /bin/bash ${USER} \ + && echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \ + && chmod 0440 /etc/sudoers.d/${USER} + +# Sets user and work directory +USER ${USER} +WORKDIR /home/${USER}