Skip to content

Commit

Permalink
New docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Feb 10, 2024
1 parent 9afa097 commit 74b758a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# https://github.com/goreleaser/goreleaser/issues/986

version: 1
project_name: databookkeeping

before:
hooks:
Expand All @@ -18,6 +19,8 @@ before:
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
# get recent golib
- ./get_golib.sh

builds:
- env:
Expand Down Expand Up @@ -72,6 +75,22 @@ archives:
- README.md
- LICENSE

dockers:
- image_templates:
- "chesscomputing/{{ .ProjectName }}/{{ .ProjectName }}:{{ .Tag }}"
- "chesscomputing/{{ .ProjectName }}/{{ .ProjectName }}:latest"
dockerfile: Dockerfile
# do not push yet to repo as it requires login first
# this will be done in CI/CD, see .github/workflows/goreleaser.yml
skip_push: true
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Tag}}"
- "--label=org.opencontainers.image.description=\"FOXDEN DataBookkeeping service\""

checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:latest as go-builder
MAINTAINER Valentin Kuznetsov [email protected]

# build procedure
ENV PROJECT=DataBookkeeping
ENV WDIR=/data
WORKDIR $WDIR
RUN mkdir /build
RUN git clone https://github.com/CHESSComputing/$PROJECT
ARG CGO_ENABLED=0
RUN cd $PROJECT && make && cp srv /build

# build final image for given image
# FROM alpine as final
# RUN mkdir -p /data
FROM gcr.io/distroless/static as final
COPY --from=go-builder /build/srv /data

0 comments on commit 74b758a

Please sign in to comment.