Skip to content

Commit

Permalink
feature: CLDSRV-278 add github action to release image for fed
Browse files Browse the repository at this point in the history
  • Loading branch information
miniscruff committed Sep 14, 2022
1 parent 2a935b3 commit d4683c1
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release-federation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: release-federation

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to be released'
required: true

env:
REGISTRY_NAME: registry.scality.com
PROJECT_NAME: ${{ github.event.repository.name }}

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY_NAME }}
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: images/svc-base/Dockerfile
push: true
tags: "${{ env.REGISTRY_NAME }}/${{env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}:${{ github.event.inputs.tag }}-svc-base"
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ github.event.inputs.tag }}
tag_name: ${{ github.event.inputs.tag }}
generate_release_notes: true
target_commitish: ${{ github.sha }}
49 changes: 49 additions & 0 deletions images/svc-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM registry.scality.com/federation/nodesvc-base:7.10.6.0

WORKDIR /usr/src/app

# Keep the .git directory in order to properly report version
COPY ./package.json yarn.lock ./

ENV PYTHON=python3.9
ENV PY_VERSION=3.9.7

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
jq \
python \
git \
build-essential \
ssh \
ca-certificates \
wget \
libffi-dev \
zlib1g-dev \
&& mkdir -p /root/ssh \
&& ssh-keyscan -H github.com > /root/ssh/known_hosts

RUN cd /tmp \
&& wget https://www.python.org/ftp/python/$PY_VERSION/Python-$PY_VERSION.tgz \
&& tar -C /usr/local/bin -xzvf Python-$PY_VERSION.tgz \
&& cd /usr/local/bin/Python-$PY_VERSION \
&& ./configure --enable-optimizations \
&& make \
&& make altinstall \
&& rm -rf /tmp/Python-$PY_VERSION.tgz

RUN yarn cache clean \
&& yarn install --production --ignore-optional --ignore-engines --network-concurrency 1 \
&& apt-get autoremove --purge -y python git build-essential \
&& rm -rf /var/lib/apt/lists/* \
&& yarn cache clean \
&& rm -rf ~/.node-gyp \
&& rm -rf /tmp/yarn-*

COPY ./ ./

VOLUME ["/usr/src/app/localData","/usr/src/app/localMetadata"]

ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]
CMD [ "yarn", "start" ]

EXPOSE 8000

0 comments on commit d4683c1

Please sign in to comment.