Skip to content

Merge pull request #67 from CodeForPhilly/develop #2

Merge pull request #67 from CodeForPhilly/develop

Merge pull request #67 from CodeForPhilly/develop #2

name: 'Containers: Publish'
on:
push:
tags: [ 'v*' ]
permissions:
packages: write
jobs:
release-containers:
name: Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to ghcr.io Docker registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute Docker container image addresses
run: |
DOCKER_REPOSITORY="ghcr.io/${GITHUB_REPOSITORY,,}"
DOCKER_TAG="${GITHUB_REF:11}"
echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_ENV
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
echo "Using: ${DOCKER_REPOSITORY}/*:${DOCKER_TAG}"
# - name: 'Pull previous Docker container image: :latest'
# run: docker pull "${DOCKER_REPOSITORY}:latest" || true
- name: 'Pull previous Docker container image: frontend-static:latest'
run: docker pull "${DOCKER_REPOSITORY}/frontend-static:latest" || true
- name: 'Build Docker container image: frontend-static:latest'
run: |
docker build \
--cache-from "${DOCKER_REPOSITORY}/frontend-static:latest" \
--file frontend/Dockerfile.demo \
--build-arg SERVER_NAME=localhost \
--tag "${DOCKER_REPOSITORY}/frontend-static:latest" \
--tag "${DOCKER_REPOSITORY}/frontend-static:${DOCKER_TAG}" \
frontend
- name: 'Push Docker container image frontend-static:latest'
run: docker push "${DOCKER_REPOSITORY}/frontend-static:latest"
- name: 'Push Docker container image frontend-static:v*'
run: docker push "${DOCKER_REPOSITORY}/frontend-static:${DOCKER_TAG}"
#
#
# - name: 'Build Docker container image: backend:latest'
# run: |
# cd backend && \
# make && \
# docker image tag "${DOCKER_REPOSITORY}/backend/local:latest" "${DOCKER_REPOSITORY}/backend:latest"
#
# - name: Push Docker container image backend:latest
# run: docker push "${DOCKER_REPOSITORY}/backend:latest"
#
# - name: Push Docker container image backend:v*
# run: docker push "${DOCKER_REPOSITORY}/backend:${DOCKER_TAG}"
# - name: Push Docker container image :v*"
# run: docker push "${DOCKER_REPOSITORY}:${DOCKER_TAG}"