Merge pull request #1 from Cernobor/deploy-ci
All checks were successful
continuous-integration/drone/push Build is passing

Tweak Dockerfile & add auto-deployment stuff
This commit is contained in:
Michal Kunc 2022-02-13 17:41:09 +01:00 committed by GitHub
commit f8b42f35f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 16 deletions

41
.dockerignore Normal file
View File

@ -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

20
.drone.yml Normal file
View File

@ -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

View File

@ -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"]

4
captain-definition Normal file
View File

@ -0,0 +1,4 @@
{
"schemaVersion": 2,
"dockerfilePath": "./Dockerfile"
}