Fix args and building
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
IamTheFij 2024-01-06 15:30:41 -08:00
parent be4e0a179a
commit 9deac7cc7e
3 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,3 @@
ARG TARGETOS
ARG TARGETARCH
FROM alpine:3.19 FROM alpine:3.19
RUN mkdir /app RUN mkdir /app
@ -10,7 +7,9 @@ WORKDIR /app/
RUN addgroup -S nomad-var-dirsync && adduser -S nomad-var-dirsync -G nomad-var-dirsync RUN addgroup -S nomad-var-dirsync && adduser -S nomad-var-dirsync -G nomad-var-dirsync
# Copy binary in # Copy binary in
COPY ./dist/nomad-var-dirsync-${TARGETOS}-${TARGETARCH} ./nomad-var-dirsync ARG TARGETOS
ARG TARGETARCH
COPY ./dist/nomad-var-dirsync-$TARGETOS-$TARGETARCH /bin/nomad-var-dirsync
# Drop to non-root user # Drop to non-root user
USER nomad-var-dirsync USER nomad-var-dirsync

View File

@ -1,6 +1,3 @@
ARG TARGETOS
ARG TARGETARCH
FROM golang:1.21-alpine AS builder FROM golang:1.21-alpine AS builder
RUN apk add --no-cache git=~2 && mkdir /app RUN apk add --no-cache git=~2 && mkdir /app
@ -12,10 +9,12 @@ RUN go mod download
COPY ./*.go /app/ COPY ./*.go /app/
ARG VERSION=dev ARG VERSION=dev
ENV CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH
RUN go build -ldflags "-X main.version=VERSION" -a -installsuffix nocgo -o nomad-var-dirsync . RUN go build -ldflags "-X main.version=VERSION" -a -installsuffix nocgo -o nomad-var-dirsync .
FROM REPO/alpine:3.19 FROM alpine:3.19
RUN mkdir /app RUN mkdir /app
WORKDIR /app/ WORKDIR /app/

View File

@ -1,5 +1,5 @@
APP_NAME = nomad-var-dirsync APP_NAME = nomad-var-dirsync
DOCKER_TAG ?= $(APP_NAME)-USER DOCKER_TAG ?= $(APP_NAME)-$(USER)
VERSION ?= $(shell git describe --tags --dirty) VERSION ?= $(shell git describe --tags --dirty)
GOFILES = *.go GOFILES = *.go
# Multi-arch targets are generated from this # Multi-arch targets are generated from this