Merge branch 'MSP-5494' into 'master'
MSP-5494 See merge request isp/isp-system-service!9
This commit is contained in:
commit
f7d84c21ab
2 files changed
+25
-19
No files matched your search
@@ -1,7 +1,9 @@
|
||||
name: Create and publish a Docker image
|
||||
|
||||
on:
|
||||
push
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
@@ -19,10 +21,10 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Read version from file
|
||||
- name: Get version from tag
|
||||
id: version_reader
|
||||
run: |
|
||||
VERSION=$(cat .version)
|
||||
VERSION=${GITHUB_REF_NAME#v}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@@ -43,7 +45,7 @@ jobs:
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
|
||||
${{ github.ref == 'refs/heads/main' && format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) || ''}}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
||||
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
|
||||
@@ -55,4 +57,4 @@ jobs:
|
||||
with:
|
||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
||||
subject-digest: ${{ steps.push.outputs.digest }}
|
||||
push-to-registry: true
|
||||
push-to-registry: true
|
||||
+18
-14
@@ -1,28 +1,32 @@
|
||||
FROM golang:1.24-alpine3.20 AS builder
|
||||
FROM golang:1.24-alpine as builder
|
||||
WORKDIR /build
|
||||
ARG version
|
||||
ENV version_env=$version
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY . .
|
||||
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,source=go.sum,target=go.sum \
|
||||
--mount=type=bind,source=go.mod,target=go.mod \
|
||||
go mod download -x
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,target=. \
|
||||
go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||
|
||||
FROM alpine:3.20 AS runner
|
||||
FROM alpine:3.21
|
||||
|
||||
RUN apk add --no-cache tzdata && \
|
||||
cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime && \
|
||||
echo "Europe/Moscow" > /etc/timezone
|
||||
RUN apk add --no-cache tzdata
|
||||
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
RUN echo "Europe/Moscow" > /etc/timezone
|
||||
|
||||
ARG UID=10001
|
||||
ARG GID=10001
|
||||
|
||||
RUN addgroup -g ${GID} appuser
|
||||
RUN adduser \
|
||||
-D \
|
||||
-h "/nonexistent" \
|
||||
-s "/sbin/nologin" \
|
||||
-u "${UID}" \
|
||||
-G appuser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
appuser
|
||||
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
Reference in new issue
Block a user