diff --git a/.github/workflows/build-milpedia.yaml b/.github/workflows/build-milpedia.yaml new file mode 100644 index 00000000..0c25dba8 --- /dev/null +++ b/.github/workflows/build-milpedia.yaml @@ -0,0 +1,62 @@ +--- +name: Build MILpedia image + +on: + push: + paths: + - 'infra/services/milpedia' + - 'branding/mil_white.svg' + - '.github/workflows/build-milpedia.yaml' + workflow_dispatch: + schedule: + - cron: '0 4 * * *' # Daily at 4:00 AM UTC + +# Cancels this run if a new one referring to the same object and same workflow +# is requested +concurrency: + group: > + ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-milpedia: + name: Build MILpedia Docker Image + runs-on: ubuntu-latest + steps: + - name: Check out code from GitHub + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Login into ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # Generates a useful and pretty ref_name: + # * 'latest' for pushes to main + # * 'branch--' for pushes to other branches (with + # slashes substituted) + - name: Generate ref name + id: ref_name + run: | + if [ "${GITHUB_REF##refs/heads/}" = "main" ]; then + echo "ref_name=latest" >> "$GITHUB_OUTPUT" + else + branch_name=$(echo "${GITHUB_REF##refs/heads/}" | tr '/' '-') + echo "ref_name=branch-${branch_name}-${GITHUB_SHA::7}" \ + >> "$GITHUB_OUTPUT" + fi + + - name: Build and push MILpedia image + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64, linux/arm64 + push: true + tags: ghcr.io/uf-mil/milpedia:${{ steps.ref_name.outputs.ref_name }} + file: infra/services/milpedia/Dockerfile diff --git a/infra/services/milpedia/Dockerfile b/infra/services/milpedia/Dockerfile index da5c76bb..ee8a23df 100644 --- a/infra/services/milpedia/Dockerfile +++ b/infra/services/milpedia/Dockerfile @@ -29,7 +29,7 @@ RUN git clone --depth 1 https://github.com/wikimedia/mediawiki-extensions-Citoid git clone --depth 1 https://github.com/wikimedia/mediawiki-extensions-TemplateStyles /var/www/html/extensions/TemplateStyles -b REL1_43 # Install vim (for easier debugging) and wget -RUN apt-get update && apt-get install -y vim=2:9.0.1378-2+deb12u2 wget=1.21.4-1ubuntu4.1 --no-install-recommends && \ +RUN apt-get update && apt-get install -y vim=2:9.0.1378-2+deb12u2 wget=1.21.3-1+deb12u1 --no-install-recommends && \ apt-get clean && rm -rf /var/lib/apt/lists/* # Install composer