[add] docker publish
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-10-24 07:39:37 -04:00
parent b8aef52913
commit 1f59ef7813
5 changed files with 54 additions and 17 deletions

View File

@@ -1,25 +1,19 @@
# Certificate Store
FROM alpine as certs
FROM alpine AS certs
RUN apk update && apk add ca-certificates
# Build Image
FROM --platform=$BUILDPLATFORM golang:1.20 AS build
FROM golang:1.20 AS build
# Install Dependencies
RUN apt-get update -y
RUN apt install -y gcc-x86-64-linux-gnu
# Copy Source
WORKDIR /src
COPY . .
# 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; \
# Compile
RUN go build -o /opt/bookmanager/server; \
cp -a ./templates /opt/bookmanager/templates; \
cp -a ./assets /opt/bookmanager/assets;