Skip to content

Commit

Permalink
enable github workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Dweb Fan <[email protected]>
  • Loading branch information
dwebfan committed May 2, 2024
1 parent 2388c61 commit 891ba51
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: test-pr
on:
push:
#pull_request:
# types:
# - opened
# - synchronize
# - reopened
jobs:
lint:
runs-on: ubuntu-22.04
container:
image: lomorage/lomo-backup:1.0
env:
PATH: /bin:/usr/bin:/usr/local/bin:/usr/local/go/bin
GOFLAGS: "-buildvcs=false"
steps:
- uses: actions/checkout@v4
- run: make lint

install:
runs-on: ubuntu-22.04
container:
image: lomorage/lomo-backup:1.0
env:
PATH: /bin:/usr/bin:/usr/local/bin:/usr/local/go/bin
GOBIN: /usr/local/bin
GOFLAGS: "-buildvcs=false"
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- run: make install
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: vendor

SHELL=/bin/bash # Use bash syntax
GOPATH=/go

vendor:
go mod vendor

lint:
golangci-lint run --modules-download-mode vendor -v --max-same-issues 10

install:
go install -v ./cmd/...

dev-container:
docker build --tag "lomorage/lomo-backup:1.0" -f dockerfiles/dev-image .

dev:
docker build --tag "lomorage/lomo-backup" -f dockerfiles/dev-run .
docker rm -f lomo-backup
docker run \
--name lomo-backup --hostname lomo-backup \
--privileged --cap-add=ALL -v /dev:/dev -v /lib/modules:/lib/modules \
-v "${PWD}:/go/src/github.com/lomorage/lomo-backup" \
--net host --dns-search local \
-it "lomorage/lomo-backup" -d bash
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Lomo-backup - Most cost saving 2-stages cloud backup solution

[![GitHub Actions](https://github.com/lomorage/lomo-backup/workflows/main/badge.svg)](https://github.com/lomorage/lomo-backup/actions?query=workflow%3Amain)



# Motivation
Photos/videos are very import personal assets and we want to store in our home instead of clouds. We developped lomorage application to self host our own google photo alternative solutions, which has met our main goal.

Expand Down
19 changes: 19 additions & 0 deletions dockerfiles/dev-image
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND noninteractive
ENV GOPATH=/go

RUN apt-get -yqq update && apt-get install -yq --no-install-recommends man-db vim build-essential \
sqlite3 curl apt-transport-https ca-certificates software-properties-common \
&& apt-get install -yq sqlite3 \
&& apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/

# install docker
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get -yqq update && apt-get install -yq docker-ce && apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpkg,cache,log}/


RUN curl -fsSL https://go.dev/dl/go1.21.0.linux-amd64.tar.gz | tar xz -C /usr/local

RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
9 changes: 9 additions & 0 deletions dockerfiles/dev-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM "lomorage/lomo-backup:1.0"
ENV GOPATH=/go
ENV GOROOT=/usr/local/go
ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin
WORKDIR /go/src/github.com/lomorage/lomo-backup

COPY ./dockerfiles/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ENTRYPOINT /entrypoint.sh "$@"
8 changes: 8 additions & 0 deletions dockerfiles/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -x

echo user: $USER
echo uid: $UID

$@

0 comments on commit 891ba51

Please sign in to comment.