This commit is contained in:
parent
b8aef52913
commit
1f59ef7813
19
.drone.yml
19
.drone.yml
@ -3,15 +3,13 @@ type: kubernetes
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: generate_tags
|
# Unit Tests
|
||||||
image: node
|
|
||||||
commands:
|
|
||||||
- echo -n "${DRONE_BRANCH}-$(date +'%Y%m%d%H%M%S')-${DRONE_COMMIT:0:10}, latest" > .tags
|
|
||||||
- name: unit test
|
- name: unit test
|
||||||
image: golang
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
- make tests_unit
|
- make tests_unit
|
||||||
|
|
||||||
|
# Integration Tests (Every Month)
|
||||||
- name: integration test
|
- name: integration test
|
||||||
image: golang
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
@ -21,3 +19,16 @@ steps:
|
|||||||
- cron
|
- cron
|
||||||
cron:
|
cron:
|
||||||
- integration-test
|
- integration-test
|
||||||
|
|
||||||
|
# Publish Dev Docker Image
|
||||||
|
- name: publish_docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: gitea.va.reichard.io/evan/bookmanager
|
||||||
|
registry: gitea.va.reichard.io
|
||||||
|
tags:
|
||||||
|
- dev
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
20
Dockerfile
20
Dockerfile
@ -1,25 +1,19 @@
|
|||||||
# Certificate Store
|
# Certificate Store
|
||||||
FROM alpine as certs
|
FROM alpine AS certs
|
||||||
RUN apk update && apk add ca-certificates
|
RUN apk update && apk add ca-certificates
|
||||||
|
|
||||||
# Build Image
|
# Build Image
|
||||||
FROM --platform=$BUILDPLATFORM golang:1.20 AS build
|
FROM golang:1.20 AS build
|
||||||
|
|
||||||
# Install Dependencies
|
# Copy Source
|
||||||
RUN apt-get update -y
|
WORKDIR /src
|
||||||
RUN apt install -y gcc-x86-64-linux-gnu
|
COPY . .
|
||||||
|
|
||||||
# Create Package Directory
|
# Create Package Directory
|
||||||
WORKDIR /src
|
|
||||||
RUN mkdir -p /opt/bookmanager
|
RUN mkdir -p /opt/bookmanager
|
||||||
|
|
||||||
# Cache Dependencies & Compile
|
# Compile
|
||||||
ARG TARGETOS
|
RUN go build -o /opt/bookmanager/server; \
|
||||||
ARG TARGETARCH
|
|
||||||
RUN --mount=target=. \
|
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
--mount=type=cache,target=/go/pkg \
|
|
||||||
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /opt/bookmanager/server; \
|
|
||||||
cp -a ./templates /opt/bookmanager/templates; \
|
cp -a ./templates /opt/bookmanager/templates; \
|
||||||
cp -a ./assets /opt/bookmanager/assets;
|
cp -a ./assets /opt/bookmanager/assets;
|
||||||
|
|
||||||
|
28
Dockerfile-BuildKit
Normal file
28
Dockerfile-BuildKit
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Certificate Store
|
||||||
|
FROM alpine AS certs
|
||||||
|
RUN apk update && apk add ca-certificates
|
||||||
|
|
||||||
|
# Build Image
|
||||||
|
FROM --platform=$BUILDPLATFORM golang:1.20 AS build
|
||||||
|
|
||||||
|
# Create Package Directory
|
||||||
|
WORKDIR /src
|
||||||
|
RUN mkdir -p /opt/bookmanager
|
||||||
|
|
||||||
|
# Cache Dependencies & Compile
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
RUN --mount=target=. \
|
||||||
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
--mount=type=cache,target=/go/pkg \
|
||||||
|
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /opt/bookmanager/server; \
|
||||||
|
cp -a ./templates /opt/bookmanager/templates; \
|
||||||
|
cp -a ./assets /opt/bookmanager/assets;
|
||||||
|
|
||||||
|
# Create Image
|
||||||
|
FROM busybox:1.36
|
||||||
|
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
|
||||||
|
COPY --from=build /opt/bookmanager /opt/bookmanager
|
||||||
|
WORKDIR /opt/bookmanager
|
||||||
|
EXPOSE 8585
|
||||||
|
ENTRYPOINT ["/opt/bookmanager/server", "serve"]
|
2
Makefile
2
Makefile
@ -17,6 +17,7 @@ docker_build_release_dev:
|
|||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/amd64,linux/arm64 \
|
--platform linux/amd64,linux/arm64 \
|
||||||
-t gitea.va.reichard.io/evan/bookmanager:dev \
|
-t gitea.va.reichard.io/evan/bookmanager:dev \
|
||||||
|
-f Dockerfile-BuildKit \
|
||||||
--push .
|
--push .
|
||||||
|
|
||||||
docker_build_release_latest:
|
docker_build_release_latest:
|
||||||
@ -24,6 +25,7 @@ docker_build_release_latest:
|
|||||||
--platform linux/amd64,linux/arm64 \
|
--platform linux/amd64,linux/arm64 \
|
||||||
-t gitea.va.reichard.io/evan/bookmanager:latest \
|
-t gitea.va.reichard.io/evan/bookmanager:latest \
|
||||||
-t gitea.va.reichard.io/evan/bookmanager:`git describe --tags` \
|
-t gitea.va.reichard.io/evan/bookmanager:`git describe --tags` \
|
||||||
|
-f Dockerfile-BuildKit \
|
||||||
--push .
|
--push .
|
||||||
|
|
||||||
tests_integration:
|
tests_integration:
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
[![Build Status](https://drone.va.reichard.io/api/badges/evan/BookManager/status.svg)](https://drone.va.reichard.io/evan/BookManager)
|
||||||
|
|
||||||
This is BookManager! Will probably be renamed at some point. This repository contains:
|
This is BookManager! Will probably be renamed at some point. This repository contains:
|
||||||
|
|
||||||
- Web App / Progressive Web App (PWA)
|
- Web App / Progressive Web App (PWA)
|
||||||
|
Loading…
Reference in New Issue
Block a user