@@ -9,20 +9,31 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go: [ '1.21' ]
|
|
||||||
name: Go ${{ matrix.go }} test
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
# - uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
# - name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
# uses: actions/setup-go@v4
|
||||||
|
# with:
|
||||||
|
# go-version: 1.21
|
||||||
|
|
||||||
|
# - name: Build
|
||||||
|
# run: go build -v ./...
|
||||||
|
|
||||||
|
- name: Login to Docker registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
registry: git.nice.net.nz
|
||||||
|
username: hads
|
||||||
|
password: ${{ secrets.PAT }}
|
||||||
|
|
||||||
- name: Build
|
- name: Set up Docker Buildx
|
||||||
run: go build -v ./...
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
# - name: Test
|
- name: Build and push
|
||||||
# run: go test -v ./...
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: git.nice.net.nz/snice:latest
|
||||||
|
|||||||
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM golang:alpine AS builder
|
||||||
|
|
||||||
|
ENV VERSION 0.1.0
|
||||||
|
ENV CGO_ENABLED 0
|
||||||
|
ENV GOOS linux
|
||||||
|
ENV BUILD_DIR /build
|
||||||
|
|
||||||
|
RUN mkdir -p ${BUILD_DIR}
|
||||||
|
WORKDIR ${BUILD_DIR}
|
||||||
|
|
||||||
|
RUN adduser --system --no-create-home --uid 1000 --shell /sbin/nologin app
|
||||||
|
|
||||||
|
COPY go.* ./
|
||||||
|
COPY *.go ./
|
||||||
|
RUN go build -v -o / ./...
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
USER app
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
HEALTHCHECK --timeout=3s CMD /snice healthcheck
|
||||||
|
|
||||||
|
COPY --from=builder /etc/passwd /etc/passwd
|
||||||
|
COPY --from=builder /snice /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/snice"]
|
||||||
|
CMD ["serve"]
|
||||||
Reference in New Issue
Block a user