Skip to content

Commit

Permalink
Improve dockerfiles (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
jggoebel authored Mar 14, 2024
1 parent 335cc4a commit 90af714
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 36 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
FROM golang:1.21.1 AS sdk

WORKDIR /app
COPY . .
COPY go.mod .

# Change to the directory of the service.
RUN go mod download -x

COPY . .

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /tmp/app

Expand Down
12 changes: 7 additions & 5 deletions v3/services/accesscodesvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
##### sdk image #####
FROM golang:1.21.1 AS sdk

WORKDIR /app

# Copy everything, respecting .dockerignore.
COPY . .

# Change to the directory of the service.
WORKDIR /app/v3/services/accesscodesvc

COPY /v3/services/accesscodesvc/go.mod .
COPY /v3/go.mod /app/v3

RUN go mod download

# Copy everything, respecting .dockerignore.
COPY . /app

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/app

Expand Down
12 changes: 7 additions & 5 deletions v3/services/authnsvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
##### sdk image #####
FROM golang:1.21.1 AS sdk

WORKDIR /app

# Copy everything, respecting .dockerignore.
COPY . .

# Change to the directory of the service.
WORKDIR /app/v3/services/authnsvc

COPY /v3/services/authnsvc/go.mod .
COPY /v3/go.mod /app/v3

RUN go mod download

# Copy everything, respecting .dockerignore.
COPY . /app

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/app

Expand Down
12 changes: 7 additions & 5 deletions v3/services/authrsvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
##### sdk image #####
FROM golang:1.21.1 AS sdk

WORKDIR /app

# Copy everything, respecting .dockerignore.
COPY . .

# Change to the directory of the service.
WORKDIR /app/v3/services/authrsvc

COPY /v3/services/authrsvc/go.mod .
COPY /v3/go.mod /app/v3

RUN go mod download

# Copy everything, respecting .dockerignore.
COPY . /app

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/app

Expand Down
12 changes: 7 additions & 5 deletions v3/services/conversionsvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
##### sdk image #####
FROM golang:1.21.1 AS sdk

WORKDIR /app

# Copy everything, respecting .dockerignore.
COPY . .

# Change to the directory of the service.
WORKDIR /app/v3/services/conversionsvc

COPY /v3/services/conversionsvc/go.mod .
COPY /v3/go.mod /app/v3

RUN go mod download

# Copy everything, respecting .dockerignore.
COPY . /app

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/app

Expand Down
12 changes: 7 additions & 5 deletions v3/services/rbacsvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
##### sdk image #####
FROM golang:1.21.1 AS sdk

WORKDIR /app

# Copy everything, respecting .dockerignore.
COPY . .

# Change to the directory of the service.
WORKDIR /app/v3/services/rbacsvc

COPY /v3/services/rbacsvc/go.mod .
COPY /v3/go.mod /app/v3

RUN go mod download

# Copy everything, respecting .dockerignore.
COPY . /app

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/app

Expand Down
12 changes: 7 additions & 5 deletions v3/services/settingsvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
##### sdk image #####
FROM golang:1.21.1 AS sdk

WORKDIR /app

# Copy everything, respecting .dockerignore.
COPY . .

# Change to the directory of the service.
WORKDIR /app/v3/services/settingsvc

COPY /v3/services/settingsvc/go.mod .
COPY /v3/go.mod /app/v3

RUN go mod download

# Copy everything, respecting .dockerignore.
COPY . /app

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/app

Expand Down
12 changes: 7 additions & 5 deletions v3/services/usersvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
##### sdk image #####
FROM golang:1.21.1 AS sdk

WORKDIR /app

# Copy everything, respecting .dockerignore.
COPY . .

# Change to the directory of the service.
WORKDIR /app/v3/services/usersvc

COPY /v3/services/usersvc/go.mod .
COPY /v3/go.mod /app/v3

RUN go mod download

# Copy everything, respecting .dockerignore.
COPY . /app

# Build the service. The output binary is named "app".
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/app

Expand Down

0 comments on commit 90af714

Please sign in to comment.