mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
ci: use AWS ECR Public base images for lti builds
This commit is contained in:
@@ -59,6 +59,9 @@ build_mr:
|
|||||||
- *ecr_login
|
- *ecr_login
|
||||||
script: |
|
script: |
|
||||||
set -eu
|
set -eu
|
||||||
|
# force base image pulls via AWS ECR Public to avoid Docker Hub TLS timeout
|
||||||
|
sed -i 's|^FROM golang:1.23-alpine AS builder$|FROM public.ecr.aws/docker/library/golang:1.23-alpine AS builder|' Dockerfile
|
||||||
|
sed -i 's|^FROM alpine:3.20$|FROM public.ecr.aws/docker/library/alpine:3.20|' Dockerfile
|
||||||
echo "Build (MR) : $ECR_REPOSITORY:$IMAGE_TAG"
|
echo "Build (MR) : $ECR_REPOSITORY:$IMAGE_TAG"
|
||||||
docker build --platform "$TARGET_PLATFORM" -f Dockerfile -t "$ECR_REPOSITORY:$IMAGE_TAG" .
|
docker build --platform "$TARGET_PLATFORM" -f Dockerfile -t "$ECR_REPOSITORY:$IMAGE_TAG" .
|
||||||
echo "Pushing image for MR..."
|
echo "Pushing image for MR..."
|
||||||
@@ -82,6 +85,9 @@ build_push_dev:
|
|||||||
- *ecr_login
|
- *ecr_login
|
||||||
script: |
|
script: |
|
||||||
set -eu
|
set -eu
|
||||||
|
# force base image pulls via AWS ECR Public to avoid Docker Hub TLS timeout
|
||||||
|
sed -i 's|^FROM golang:1.23-alpine AS builder$|FROM public.ecr.aws/docker/library/golang:1.23-alpine AS builder|' Dockerfile
|
||||||
|
sed -i 's|^FROM alpine:3.20$|FROM public.ecr.aws/docker/library/alpine:3.20|' Dockerfile
|
||||||
echo "Build & push (dev): $ECR_REPOSITORY:$IMAGE_TAG"
|
echo "Build & push (dev): $ECR_REPOSITORY:$IMAGE_TAG"
|
||||||
docker build --platform "$TARGET_PLATFORM" -f Dockerfile -t "$ECR_REPOSITORY:$IMAGE_TAG" .
|
docker build --platform "$TARGET_PLATFORM" -f Dockerfile -t "$ECR_REPOSITORY:$IMAGE_TAG" .
|
||||||
docker push "$ECR_REPOSITORY:$IMAGE_TAG"
|
docker push "$ECR_REPOSITORY:$IMAGE_TAG"
|
||||||
@@ -138,6 +144,9 @@ build_push_prod:
|
|||||||
- *ecr_login
|
- *ecr_login
|
||||||
script: |
|
script: |
|
||||||
set -eu
|
set -eu
|
||||||
|
# force base image pulls via AWS ECR Public to avoid Docker Hub TLS timeout
|
||||||
|
sed -i 's|^FROM golang:1.23-alpine AS builder$|FROM public.ecr.aws/docker/library/golang:1.23-alpine AS builder|' Dockerfile
|
||||||
|
sed -i 's|^FROM alpine:3.20$|FROM public.ecr.aws/docker/library/alpine:3.20|' Dockerfile
|
||||||
echo "Build & push (prod): $ECR_REPOSITORY:$IMAGE_TAG"
|
echo "Build & push (prod): $ECR_REPOSITORY:$IMAGE_TAG"
|
||||||
docker build --platform "$TARGET_PLATFORM" -f Dockerfile -t "$ECR_REPOSITORY:$IMAGE_TAG" .
|
docker build --platform "$TARGET_PLATFORM" -f Dockerfile -t "$ECR_REPOSITORY:$IMAGE_TAG" .
|
||||||
docker push "$ECR_REPOSITORY:$IMAGE_TAG"
|
docker push "$ECR_REPOSITORY:$IMAGE_TAG"
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
# =========================
|
# =========================
|
||||||
# Builder stage
|
# Builder stage
|
||||||
# =========================
|
# =========================
|
||||||
FROM golang:1.23-alpine AS builder
|
FROM public.ecr.aws/docker/library/golang:1.23-alpine AS builder
|
||||||
|
|
||||||
RUN apk add --no-cache git ca-certificates tzdata
|
RUN apk add --no-cache git ca-certificates tzdata
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -25,7 +25,7 @@ RUN GOBIN=/usr/local/bin go install -tags "postgres file" -ldflags="-s -w" githu
|
|||||||
# =========================
|
# =========================
|
||||||
# Runtime stage
|
# Runtime stage
|
||||||
# =========================
|
# =========================
|
||||||
FROM alpine:3.20
|
FROM public.ecr.aws/docker/library/alpine:3.20
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates tzdata curl bash postgresql-client \
|
RUN apk add --no-cache ca-certificates tzdata curl bash postgresql-client \
|
||||||
&& adduser -D -H -u 10001 appuser
|
&& adduser -D -H -u 10001 appuser
|
||||||
|
|||||||
Reference in New Issue
Block a user