From 28089f325c03fecd95a0d974c1fe0477d3eb8754 Mon Sep 17 00:00:00 2001 From: Mark Murnane Date: Wed, 22 Feb 2023 21:18:07 -0500 Subject: [PATCH] Adding docker build --- .github/workflows/ci-docker.yaml | 25 +++++++++++++++ Dockerfile | 54 ++++++++++++++++++++++---------- 2 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/ci-docker.yaml diff --git a/.github/workflows/ci-docker.yaml b/.github/workflows/ci-docker.yaml new file mode 100644 index 0000000..624d69d --- /dev/null +++ b/.github/workflows/ci-docker.yaml @@ -0,0 +1,25 @@ +--- +name: Build Docker Image + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v1 + + - name: Login to GHCR + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v2 + with: + context: "." + push: true + tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }} diff --git a/Dockerfile b/Dockerfile index 57404ff..13c656e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM python:3.4.5 +FROM python:3.6.14 MAINTAINER RAMS Project "code@magfest.org" LABEL version.sideboard ="1.0" WORKDIR /app # This is actually the least bad way to compose two Dockerfile tech stacks right now. # The following is copied and pasted from the Node Dockerfile at -# https://github.com/nodejs/docker-node/blob/28425ed95cebaea2ff589c1516d79c60181983b2/7.4/Dockerfile +# https://github.com/nodejs/docker-node/blob/main/12/buster/Dockerfile # Update this comment and change the entire copypasta section to upgrade Node version ######################################### @@ -15,25 +15,45 @@ WORKDIR /app RUN groupadd --gid 1000 node \ && useradd --uid 1000 --gid node --shell /bin/bash --create-home node -# gpg keys listed at https://github.com/nodejs/node#release-team -RUN set -ex \ +ENV NODE_VERSION 12.22.3 + +RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + # gpg keys listed at https://github.com/nodejs/node#release-keys + && set -ex \ && for key in \ - 9554F04D7259F04124DE6B476D5A82AC7E37093B \ + 4ED778F539E3634C779C87C6D7062848A1AB005C \ 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ - FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ - DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ - B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ - 56730D5401028683275BD23C23EFEFE93C4CFFFE \ + C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ + 108F52B48DB57BB0CC439B2997B01419BD92F80A \ + B9E2F5981AA6E0CD28160D9FF13993A75599653C \ ; do \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ - gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ - gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \ - done - -ENV NPM_CONFIG_LOGLEVEL info -ENV NODE_VERSION 7.10.0 + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ + done \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + # smoke tests + && node --version \ + && npm --version RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \ && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ @@ -52,7 +72,7 @@ RUN apt-get update && apt-get install -y libcap-dev && rm -rf /var/lib/apt/lists ADD . /app/ RUN pip3 install virtualenv \ && virtualenv --always-copy /app/env \ - && /app/env/bin/pip3 install paver + && /app/env/bin/pip3 install paver "setuptools<58" RUN /app/env/bin/paver install_deps CMD /app/env/bin/python3 /app/sideboard/run_server.py