From 4773a511fe3212bbdc5fbfdf6de90792c31a9c56 Mon Sep 17 00:00:00 2001 From: Oliver Killane Date: Tue, 26 Sep 2023 16:44:20 +0100 Subject: [PATCH] added docker build --- .devcontainer/Dockerfile | 25 ++++++++++++++++++++++ .devcontainer/devcontainer.json | 15 ++++++++++++++ .github/workflows/push-dev-image.yaml | 30 +++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/push-dev-image.yaml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..b2de030 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:latest + +ARG TL_VERSION=2023 +ARG TL_MIRROR=https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz + +# Install basic packages +RUN apt-get update -q +RUN apt-get install -qy build-essential wget sudo + +# Install basic texlive distribution +RUN cd /tmp && \ + wget --directory-prefix /tmp ${TL_MIRROR} && \ + zcat < install-tl-unx.tar.gz | tar xf - && \ + cd install-tl-* && \ + perl ./install-tl --scheme=small --no-interaction +ENV PATH="${PATH}:/usr/local/texlive/${TL_VERSION}/bin/x86_64-linux" + +# Create new user as we cannot use tlmgr as root user. +RUN groupadd -r ${DEV_USER} +RUN useradd --system --gid ${DEV_USER} --create-home ${DEV_USER} + +# Update packages and tlmgr +ENV TEXMIRROR="http://ctan.math.utah.edu/ctan/tex-archive/systems/texlive/tlnet" +RUN tlmgr init-usertree +RUN tlmgr update --self --all diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..41167aa --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +{ + "image": "ghcr.io/oliverkillane/imperial-computing-notes-dev:latest", + "customizations": { + "vscode": { + "extensions": [] + } + }, + "mounts": [ + { + "source": "${localEnv:HOME}/.ssh", + "target": "/root/.ssh", + "type": "bind" + } + ] +} \ No newline at end of file diff --git a/.github/workflows/push-dev-image.yaml b/.github/workflows/push-dev-image.yaml new file mode 100644 index 0000000..cabfbd5 --- /dev/null +++ b/.github/workflows/push-dev-image.yaml @@ -0,0 +1,30 @@ +name: Build and Publish Image + +on: + push: + branches: + - enh/development-docker + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.IMPERIAL_NOTES_GHCR_TOKEN }} + - name: Build and Push Image + uses: docker/build-push-action@v5 + with: + context: ./devcontainer + push: true + platforms: linux/amd64,linux/arm64 + tags: imperial-computing-notes-dev:latest + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file