Merge branch 'development' into 'production'

ci: switch build images to AWS ECR Public

See merge request mbugroup/lti-web-client!345
This commit is contained in:
kris
2026-03-09 03:16:17 +00:00
3 changed files with 56 additions and 30 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ default:
# ========================================================== # ==========================================================
.build_template: &build_template .build_template: &build_template
stage: build stage: build
image: node:20-alpine image: public.ecr.aws/docker/library/node:20-alpine
cache: cache:
key: npm-cache key: npm-cache
paths: paths:
@@ -56,7 +56,7 @@ default:
.deploy_template: &deploy_template .deploy_template: &deploy_template
stage: deploy stage: deploy
image: image:
name: amazon/aws-cli:latest name: public.ecr.aws/aws-cli/aws-cli:latest
entrypoint: ['/bin/sh', '-c'] entrypoint: ['/bin/sh', '-c']
script: script:
- set -e - set -e
+15 -28
View File
@@ -1,38 +1,25 @@
# ========================= FROM public.ecr.aws/docker/library/node:20-alpine
# Builder stage
# ========================= RUN apk add --no-cache git bash build-base curl
FROM golang:1.23-alpine AS builder
RUN apk add --no-cache git ca-certificates tzdata
WORKDIR /app WORKDIR /app
COPY go.mod go.sum ./ COPY package*.json ./
RUN go mod download RUN npm ci
COPY . . COPY . .
# Build API binary # Buat config agar Next tahu output: export
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ RUN echo "const config = { output: 'export', images: { unoptimized: true } }; export default config;" > next.config.mjs
go build -trimpath -ldflags="-s -w" -o lti-api ./cmd/api
# Build SEED binary (pastikan cmd/seed ada) # Build project (Next.js 15 otomatis static export)
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ RUN NEXT_DISABLE_TURBOPACK=1 npx next build
go build -trimpath -ldflags="-s -w" -o lti-seed ./cmd/seed
# ========================= # Copy static assets dan hasil build agar bisa diakses
# Runtime stage RUN mkdir -p .next/server/app/_next && \
# ========================= cp -r .next/static .next/server/app/_next/static && \
FROM alpine:3.20 cp -r public/* .next/server/app/
RUN apk add --no-cache ca-certificates tzdata curl bash postgresql-client \ EXPOSE 3000
&& adduser -D -H -u 10001 appuser
WORKDIR /app CMD ["npx", "serve", ".next/server/app", "-l", "3000"]
COPY --from=builder /app/lti-api /app/lti-api
COPY --from=builder /app/lti-seed /app/lti-seed
USER appuser
EXPOSE 8081
CMD ["/app/lti-api"]
+39
View File
@@ -0,0 +1,39 @@
version: '3.9'
services:
dev-web-lti:
container_name: dev-web-lti
build:
context: .
dockerfile: Dockerfile
ports:
- '3002:3000'
env_file:
- .env
environment:
NODE_ENV: production
APP_ENV: production
networks:
- dev-lti-network
restart: always
deploy:
resources:
limits:
cpus: '3.0'
memory: 3G
reservations:
cpus: '1.0'
memory: 512M
extra_hosts:
- 'host.docker.internal:host-gateway'
# Optional: aktifkan healthcheck jika punya endpoint
# healthcheck:
# test: ["CMD-SHELL", "curl -fsS http://localhost:3000/api/healthz || exit 1"]
# interval: 10s
# timeout: 3s
# retries: 10
# start_period: 15s
networks:
dev-lti-network:
external: true