Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use alpine as base #268

Merged
merged 4 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build & Publish Image

on:
push:
branches: ["develop", "ci-test*", "v*"]
branches: ["develop", "ci/*", "v*"]
tags: ["v*"]
paths: ["src/GZCTF/**"]
workflow_dispatch:
Expand Down
5 changes: 3 additions & 2 deletions docs/pages/deployment/k8s-only.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ This article focuses on deploying GZCTF in a Kubernetes cluster. For configurati
image: gztime/gzctf:latest
imagePullPolicy: Always
env:
- name: LANG
value: en_US # choose your backend language `en_US` / `zh_CN` / `ja_JP`
- name: GZCTF_ADMIN_PASSWORD
value: xxx # Admin password
# choose your backend language `en_US` / `zh_CN` / `ja_JP`
- name: LC_ALL
value: en_US.UTF-8
ports:
- containerPort: 8080
name: http
Expand Down
5 changes: 3 additions & 2 deletions docs/pages/deployment/k8s-only.ja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ import { Callout } from "nextra-theme-docs";
image: gztime/gzctf:latest
imagePullPolicy: Always
env:
- name: LANG
value: ja_JP # choose your backend language `en_US` / `zh_CN` / `ja_JP`
- name: GZCTF_ADMIN_PASSWORD
value: xxx # 管理者パスワード
# choose your backend language `en_US` / `zh_CN` / `ja_JP`
- name: LC_ALL
value: ja_JP.UTF-8
ports:
- containerPort: 8080
name: http
Expand Down
5 changes: 3 additions & 2 deletions docs/pages/deployment/k8s-only.zh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ import { Callout } from "nextra-theme-docs";
image: gztime/gzctf:latest
imagePullPolicy: Always
env:
- name: LANG
value: zh_CN # choose your backend language `en_US` / `zh_CN` / `ja_JP`
- name: GZCTF_ADMIN_PASSWORD
value: xxx # 管理员密码
# choose your backend language `en_US` / `zh_CN` / `ja_JP`
- name: LC_ALL
value: zh_CN.UTF-8
ports:
- containerPort: 8080
name: http
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/quick-start.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ You will need to install Docker and docker-compose to get started with GZCTF. Yo
image: gztime/gzctf:latest
restart: always
environment:
- "LANG=en_US.UTF-8" # choose your backend language `en_US` / `zh_CN` / `ja_JP`
- "GZCTF_ADMIN_PASSWORD=<Your GZCTF_ADMIN_PASSWORD>"
# choose your backend language `en_US` / `zh_CN` / `ja_JP`
- "LC_ALL=en_US.UTF-8"
ports:
- "80:8080"
volumes:
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/quick-start.ja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ GZCTF の使用をすぐに開始するには、Docker と docker-compose をイ
image: gztime/gzctf:latest
restart: always
environment:
- "LANG=ja_JP.UTF-8" # choose your backend language `en_US` / `zh_CN` / `ja_JP`
- "GZCTF_ADMIN_PASSWORD=<Your GZCTF_ADMIN_PASSWORD>"
# choose your backend language `en_US` / `zh_CN` / `ja_JP`
- "LC_ALL=ja_JP.UTF-8"
ports:
- "80:8080"
volumes:
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/quick-start.zh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ GZCTF 的安全性和前端功能(如操作剪贴板)依赖于 HTTPS,此
image: gztime/gzctf:latest
restart: always
environment:
- "LANG=zh_CN.UTF-8" # choose your backend language `en_US` / `zh_CN` / `ja_JP`
- "GZCTF_ADMIN_PASSWORD=<Your GZCTF_ADMIN_PASSWORD>"
# choose your backend language `en_US` / `zh_CN` / `ja_JP`
- "LC_ALL=zh_CN.UTF-8"
ports:
- "80:8080"
volumes:
Expand Down
14 changes: 9 additions & 5 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
ARG TIMESTAMP
ARG GIT_SHA
ARG GIT_NAME
ENV VITE_APP_BUILD_TIMESTAMP=$TIMESTAMP
ENV VITE_APP_GIT_SHA=$GIT_SHA
ENV VITE_APP_GIT_NAME=$GIT_NAME
ENV VITE_APP_BUILD_TIMESTAMP=$TIMESTAMP \
VITE_APP_GIT_SHA=$GIT_SHA \
VITE_APP_GIT_NAME=$GIT_NAME

RUN apt update && apt install -y wget gnupg2 libpcap0.8 && \
wget -qO- https://deb.nodesource.com/setup_20.x | bash - && \
Expand All @@ -21,12 +21,16 @@ RUN dotnet build "GZCTF.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "GZCTF.csproj" -c Release -o /app/publish -r linux-x64 --no-self-contained /p:PublishReadyToRun=true

FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy AS final
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LC_ALL=en_US.UTF-8

WORKDIR /app
EXPOSE 8080
RUN apk add --no-cache wget libpcap icu-data-full icu-libs

COPY --from=publish /app/publish .
RUN apt update && apt install -y wget libpcap0.8 --no-install-recommends && rm -rf /var/lib/apt/lists/*

HEALTHCHECK --interval=5m --timeout=3s --start-period=10s --retries=1 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1
Expand Down
12 changes: 8 additions & 4 deletions src/GZCTF/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ ARG TARGETPLATFORM
COPY publish /build
RUN cp -r /build/${TARGETPLATFORM} /publish

FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy AS final
WORKDIR /app
COPY --from=build /publish .
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LC_ALL=en_US.UTF-8

WORKDIR /app
EXPOSE 8080
RUN apk add --no-cache wget libpcap icu-data-full icu-libs

COPY --from=build /publish .

RUN apt update && apt install -y wget libpcap0.8 --no-install-recommends && rm -rf /var/lib/apt/lists/*
HEALTHCHECK --interval=5m --timeout=3s --start-period=10s --retries=1 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1

Expand Down
Loading