Skip to content

Commit

Permalink
Release docker images to Github registry
Browse files Browse the repository at this point in the history
  • Loading branch information
cld9x authored Jan 16, 2022
1 parent 61b7cf8 commit 517426e
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 43 deletions.
16 changes: 0 additions & 16 deletions .drone.dockerfile

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@ jobs:

runs-on: ubuntu-latest

env:
DOCKER_CLI_EXPERIMENTAL: "enabled"

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Build UI
run: cd ui && yarn install && yarn build

- name: Setup release environment
run: |-
echo 'GITHUB_TOKEN=${{secrets.GORELEASER_ACCESS_TOKEN}}' > .release-env
echo 'GITHUB_USER=${{github.event.repository.owner.login}}' >> .release-env
echo 'GITHUB_PROJECT=${{github.event.repository.name}}' >> .release-env
echo 'DOCKER_CREDS_FILE=.docker-creds' >> .release-env
echo '${{github.event.repository.owner.login}}:${{secrets.GORELEASER_ACCESS_TOKEN}}:ghcr.io' >> .docker-creds
- name: Release publish
run: make release
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ node_modules/
/ui/public/static/bundle.*
npm-debug.log
yarn-error.log

.release-env
.docker-creds
87 changes: 80 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ before:
- go generate ./...

builds:
- id: xbvr-mac
- id: xbvr-mac-intel
binary: xbvr
# main: pkg/tray/main.go
flags:
Expand All @@ -22,6 +22,24 @@ builds:
# hooks:
# post: ./appify.sh -s ./dist/xbvr-mac_darwin_amd64/XBVR.app/Contents/MacOS/XBVR -i ./ui/public/icons/xbvr-mac.icns -n XBVR

- id: xbvr-mac-m1
binary: xbvr
# main: pkg/tray/main.go
flags:
- -tags=json1
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
goos:
- darwin
goarch:
- arm64
# hooks:
# post: ./appify.sh -s ./dist/xbvr-mac_darwin_amd64/XBVR.app/Contents/MacOS/XBVR -i ./ui/public/icons/xbvr-mac.icns -n XBVR

- id: xbvr-windows
binary: xbvr
main: pkg/tray/main.go
Expand Down Expand Up @@ -61,6 +79,48 @@ builds:
goarch:
- arm64

dockers:
-
use: buildx
dockerfile: Dockerfile
goos: linux
goarch: amd64
image_templates:
- ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:{{ .Version }}-amd64
build_flag_templates:
- --platform=linux/amd64
- --no-cache
- --label=org.opencontainers.image.source=https://github.com/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
-
use: buildx
dockerfile: Dockerfile
goos: linux
goarch: arm64
image_templates:
- ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:{{ .Version }}-arm64
build_flag_templates:
- --platform=linux/arm64
- --no-cache
- --label=org.opencontainers.image.source=https://github.com/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}

docker_manifests:
- name_template: ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:{{ .Version }}
image_templates:
- ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:{{ .Version }}-amd64
- ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:{{ .Version }}-arm64
- name_template: ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:latest
image_templates:
- ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:{{ .Version }}-amd64
- ghcr.io/{{.Env.GITHUB_USER}}/{{.Env.GITHUB_PROJECT}}:{{ .Version }}-arm64

archives:
- id: archive-linux
builds:
Expand All @@ -78,26 +138,39 @@ archives:
windows: Windows
- id: archive-mac
builds:
- xbvr-mac
- xbvr-mac-intel
- xbvr-mac-m1
format: zip
replacements:
darwin: macOS
amd64: intel
arm64: m1
# files:
# - XBVR.app/Contents/Resources/XBVR.icns
# - XBVR.app/Contents/Info.plist

snapshot:
name_template: "{{ .Tag }}-next"

checksum:
name_template: "checksums.txt"

changelog:
use: github
sort: asc
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: 'Bug fixes'
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: Others
order: 999
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^test:"

release:
disable: false
github:
owner: xbapps
name: xbvr
24 changes: 6 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
FROM node:12 as build-env
FROM ubuntu:20.04

### Install Go ###
ENV GO_VERSION=1.17.5 \
GOPATH=$HOME/go-packages \
GOROOT=$HOME/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
RUN curl -fsSL https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz | tar -xzv
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 ca-certificates && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app
ADD . /app
RUN cd /app && \
yarn install && \
yarn build && \
go generate && \
go build -tags='json1' -ldflags '-w' -o xbvr main.go

FROM gcr.io/distroless/base
COPY --from=build-env /app/xbvr /
COPY xbvr /usr/bin/xbvr

EXPOSE 9998-9999
VOLUME /root/.config/

ENTRYPOINT ["/xbvr"]
CMD ["/usr/bin/xbvr"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ To run this container in docker:

```
docker run -t --name=xbvr --net=host --restart=always \
--mount type=bind,source=/path/to/your/videos,target=/videos,readonly \
--mount type=bind,source=/path/to/your/videos,target=/videos \
--mount source=xbvr-config,target=/root/.config/ \
xbapps/xbvr:latest
ghcr.io/xbapps/xbvr:latest
```

Adding `-d` to the docker command will run the container in the background.
Expand Down

0 comments on commit 517426e

Please sign in to comment.