Skip to content

Commit

Permalink
deployment (#25)
Browse files Browse the repository at this point in the history
* import from original repo

Signed-off-by: Pablo <[email protected]>

* fix set-output

Signed-off-by: Pablo <[email protected]>

* udpate base image

Signed-off-by: Pablo <[email protected]>

* update registry authentication

Signed-off-by: Pablo <[email protected]>

* update

Signed-off-by: Pablo <[email protected]>

* update login-action

Signed-off-by: Pablo <[email protected]>

* update login-action

Signed-off-by: Pablo <[email protected]>

* try seqera_cr_password

Signed-off-by: Pablo <[email protected]>

* update build-push action

Signed-off-by: Pablo <[email protected]>

* enable push

Signed-off-by: Pablo <[email protected]>

* update alpine image

Signed-off-by: Pablo <[email protected]>

* fixes dockerfile

Signed-off-by: Pablo <[email protected]>

* update base image

Signed-off-by: Pablo <[email protected]>

* use seqera docs and vendor

Signed-off-by: Pablo <[email protected]>

---------

Signed-off-by: Pablo <[email protected]>
  • Loading branch information
pabloaledo authored Jan 24, 2025
1 parent 995a9ba commit 2f3f615
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 4 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Docker

on:
push:
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+"
pull_request:

jobs:
docker:
name: Docker
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Required for correctly populating ldflags
fetch-depth: 0

- name: Calculate Docker image tags
id: tags
env:
DOCKER_IMAGES: "cr.seqera.io/public/${{ github.repository }}"
run: |
case $GITHUB_REF in
refs/tags/*) VERSION=${GITHUB_REF#refs/tags/};;
refs/heads/*) VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g');;
refs/pull/*) VERSION=pr-${{ github.event.number }};;
*) VERSION=sha-${GITHUB_SHA::8};;
esac
TAGS=()
for image in $DOCKER_IMAGES; do
TAGS+=("${image}:${VERSION}")
if [[ "${{ github.event.repository.default_branch }}" == "$VERSION" ]]; then
TAGS+=("${image}:latest")
fi
done
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::$(IFS=,; echo "${TAGS[*]}")
echo ::set-output name=commit_hash::${GITHUB_SHA::8}
echo ::set-output name=build_date::$(git show -s --format=%cI)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: cr.seqera.io
username: ${{ secrets.SEQERA_CR_USERNAME }}
password: ${{ secrets.SEQERA_CR_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.tags.outputs.tags }}
context: .
build-args: |
VERSION=${{ steps.tags.outputs.version }}
COMMIT_HASH=${{ steps.tags.outputs.commit_hash }}
BUILD_DATE=${{ steps.tags.outputs.build_date }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.version=${{ steps.tags.outputs.version }}
org.opencontainers.image.created=${{ steps.tags.outputs.build_date }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
org.opencontainers.image.vendor=Seqera Labs
org.opencontainers.image.documentation=https://seqeralabs.com/docs/pipeline/overview/
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build image
FROM golang:1.16-alpine3.13 AS builder
FROM golang:1.23-alpine3.21 AS builder

ENV GOFLAGS="-mod=readonly"

Expand Down Expand Up @@ -31,15 +31,16 @@ RUN set -xe && \


# Final image
FROM alpine:3.14.0
FROM alpine:edge

RUN apk add --update --no-cache ca-certificates tzdata bash curl

SHELL ["/bin/bash", "-c"]

# set up nsswitch.conf for Go's "netgo" implementation
# https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-424546457
RUN test ! -e /etc/nsswitch.conf && echo 'hosts: files dns' > /etc/nsswitch.conf
RUN echo 'hosts: files dns' > /etc/nsswitch.conf
#RUN test ! -e /etc/nsswitch.conf && echo 'hosts: files dns' > /etc/nsswitch.conf

ARG BUILD_TARGET

Expand All @@ -51,6 +52,6 @@ COPY configs /etc/cloudinfo/serviceconfig

RUN sed -i "s|dataLocation: ./configs/|dataLocation: /etc/cloudinfo/serviceconfig/|g" /etc/cloudinfo/serviceconfig/services.yaml

ENV CLOUDINFO_SERVICELOADER_SERVICECONFIGLOCATION "/etc/cloudinfo/serviceconfig"
ENV CLOUDINFO_SERVICELOADER_SERVICECONFIGLOCATION="/etc/cloudinfo/serviceconfig"

CMD ["cloudinfo"]

0 comments on commit 2f3f615

Please sign in to comment.