This commit is contained in:
parent
b8aef52913
commit
c940e4e111
20
.drone.yml
20
.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,17 @@ 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
|
||||||
|
dockerfile: Dockerfile-amd64
|
||||||
|
tags:
|
||||||
|
- dev
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
30
Dockerfile-amd64
Normal file
30
Dockerfile-amd64
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Certificate Store
|
||||||
|
FROM alpine as certs
|
||||||
|
RUN apk update && apk add ca-certificates
|
||||||
|
|
||||||
|
# Build Image
|
||||||
|
FROM golang:1.20 AS build
|
||||||
|
|
||||||
|
# Install Dependencies
|
||||||
|
RUN apt-get update -y
|
||||||
|
RUN apt install -y gcc-x86-64-linux-gnu
|
||||||
|
|
||||||
|
# Create Package Directory
|
||||||
|
WORKDIR /src
|
||||||
|
RUN mkdir -p /opt/bookmanager
|
||||||
|
|
||||||
|
# Cache Dependencies & Compile
|
||||||
|
RUN --mount=target=. \
|
||||||
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
--mount=type=cache,target=/go/pkg \
|
||||||
|
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"]
|
Loading…
Reference in New Issue
Block a user