From 55b55167821f8d3d40d144c7d66bb70a91102bc9 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 12 Dec 2024 13:12:21 -0800 Subject: [PATCH] docker: secrets! --- Containerfile | 4 ++-- compose.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index 6c1d819..79955ba 100644 --- a/Containerfile +++ b/Containerfile @@ -1,5 +1,5 @@ # Stage 1: Build -FROM golang:1.23 AS builder +FROM docker.io/golang:1.23 AS builder # Set the working directory in the container WORKDIR /app @@ -8,7 +8,7 @@ WORKDIR /app COPY go.mod go.sum ./ # Download dependencies -RUN go mod download +RUN --mount=type=secret,id=netrc,dst=/root/.netrc go mod download # Copy the entire project COPY . . diff --git a/compose.yaml b/compose.yaml index e312f66..fa14dbb 100644 --- a/compose.yaml +++ b/compose.yaml @@ -3,6 +3,10 @@ networks: maps-service-network: driver: bridge +secrets: + netrc: + file: /home/quat/.netrc + services: nats: image: docker.io/nats:latest @@ -15,6 +19,8 @@ services: maps-service: build: + secrets: + - netrc context: . dockerfile: Containerfile container_name: maps-service