diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..16380d1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,41 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# Project-specific +oko-server +*.sqlite* +.vscode +.git diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..de2d078 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,20 @@ +kind: pipeline +type: docker +name: default + +steps: +- name: deploy + image: caprover/cli-caprover:2.2.3 + commands: + - caprover deploy + environment: + CAPROVER_URL: + from_secret: caprover_url + CAPROVER_APP: + from_secret: caprover_app + CAPROVER_APP_TOKEN: + from_secret: app_token + CAPROVER_BRANCH: main + when: + branch: + - main diff --git a/Dockerfile b/Dockerfile index c37ce2f..81a538e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,19 @@ -FROM alpine:3.15.0 +FROM alpine:3.15.0 AS build -RUN apk add --no-cache git go && \ - mkdir /oko-server && \ - cd /oko-server && \ - git clone https://github.com/Cernobor/oko-server.git /oko-server/git && \ - cd /oko-server/git && \ - go build && \ - cp /oko-server/git/oko-server /oko-server/ && \ - cd /oko-server && \ - rm -rf /oko-server/git && \ - mkdir /data && \ - apk del git go && \ - rm -rf /root/go && \ - echo -e '#!/bin/sh\n/oko-server/oko-server "$@"' > /oko-server/entrypoint.sh && \ - chmod +x /oko-server/entrypoint.sh VOLUME ["/data"] +COPY . /oko-server/git + +RUN apk add --no-cache go && \ + cd /oko-server/git && \ + go build + +FROM alpine:3.15.0 +WORKDIR /oko-server +VOLUME [ "/data" ] + +RUN echo -e '#!/bin/sh\n/oko-server/oko-server "$@"' > /oko-server/entrypoint.sh && \ + chmod +x /oko-server/entrypoint.sh +COPY --from=build /oko-server/git/oko-server/ /oko-server/ + +ENTRYPOINT ["/oko-server/entrypoint.sh"] -ENTRYPOINT ["/oko-server/entrypoint.sh"] \ No newline at end of file diff --git a/captain-definition b/captain-definition new file mode 100644 index 0000000..17db556 --- /dev/null +++ b/captain-definition @@ -0,0 +1,4 @@ + { + "schemaVersion": 2, + "dockerfilePath": "./Dockerfile" + }