docker: secrets!

This commit is contained in:
Quaternions 2024-12-12 13:12:21 -08:00
parent 4c5d9e420d
commit 55b5516782
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,5 @@
# Stage 1: Build # Stage 1: Build
FROM golang:1.23 AS builder FROM docker.io/golang:1.23 AS builder
# Set the working directory in the container # Set the working directory in the container
WORKDIR /app WORKDIR /app
@ -8,7 +8,7 @@ WORKDIR /app
COPY go.mod go.sum ./ COPY go.mod go.sum ./
# Download dependencies # Download dependencies
RUN go mod download RUN --mount=type=secret,id=netrc,dst=/root/.netrc go mod download
# Copy the entire project # Copy the entire project
COPY . . COPY . .

View File

@ -3,6 +3,10 @@ networks:
maps-service-network: maps-service-network:
driver: bridge driver: bridge
secrets:
netrc:
file: /home/quat/.netrc
services: services:
nats: nats:
image: docker.io/nats:latest image: docker.io/nats:latest
@ -15,6 +19,8 @@ services:
maps-service: maps-service:
build: build:
secrets:
- netrc
context: . context: .
dockerfile: Containerfile dockerfile: Containerfile
container_name: maps-service container_name: maps-service