Skip to content

Commit 10db3c3

Browse files
Merge pull request #10 from speakeasy-api/docker-optimization
chore: improve docker image building
2 parents 0923279 + d2fda18 commit 10db3c3

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# syntax=docker/dockerfile:1
22

3-
# Build the application
3+
# Build a golang image based on https://docs.docker.com/language/golang/build-images
44

55
FROM golang:1.18-alpine AS build
66

77
WORKDIR /app
88

9-
COPY ./ ./
9+
COPY go.mod ./
10+
COPY go.sum ./
1011

1112
RUN go mod download
1213

13-
RUN ls -lrt
14+
COPY ./cmd/server/main.go ./cmd/server/main.go
15+
COPY ./internal/ ./internal/
1416

15-
RUN go build -o ./server ./cmd/server/main.go
17+
RUN go build -o ./server ./cmd/server/main.go
1618

1719
# Build the server image
1820

@@ -23,7 +25,9 @@ RUN apk --no-cache add ca-certificates
2325
WORKDIR /root/
2426

2527
COPY --from=0 /app/server ./
26-
COPY --from=0 /app/config/config-docker.yaml ./config/config.yaml
27-
COPY --from=0 /app/migrations/ ./migrations/
28+
COPY ./config/ ./config/
29+
COPY ./migrations/ ./migrations/
30+
31+
EXPOSE 8080
2832

2933
CMD ["./server"]

postman/Bootstrap Users.postman_collection.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"info": {
3-
"_postman_id": "261cdc45-c2f3-4783-bb17-2f19f4834116",
3+
"_postman_id": "c49976e1-35ac-4c63-87cb-2bcc6278be7f",
44
"name": "Bootstrap Users",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6-
"_exporter_id": "2180004"
6+
"_exporter_id": "21869507"
77
},
88
"item": [
99
{
@@ -65,12 +65,13 @@
6565
}
6666
},
6767
"url": {
68-
"raw": "{{scheme}}://{{host}}{{port}}/user",
68+
"raw": "{{scheme}}://{{host}}{{port}}/v1/user",
6969
"protocol": "{{scheme}}",
7070
"host": [
7171
"{{host}}{{port}}"
7272
],
7373
"path": [
74+
"v1",
7475
"user"
7576
]
7677
}

postman/Users.postman_collection.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"info": {
3-
"_postman_id": "91158b88-a3af-47f7-8d9c-50e7d889b8b5",
3+
"_postman_id": "5bbd2348-ce8e-4637-9310-e5acff3a49c0",
44
"name": "Users",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6-
"_exporter_id": "2180004"
6+
"_exporter_id": "21869507"
77
},
88
"item": [
99
{
@@ -42,12 +42,13 @@
4242
}
4343
},
4444
"url": {
45-
"raw": "{{scheme}}://{{host}}{{port}}/user",
45+
"raw": "{{scheme}}://{{host}}{{port}}/v1/user",
4646
"protocol": "{{scheme}}",
4747
"host": [
4848
"{{host}}{{port}}"
4949
],
5050
"path": [
51+
"v1",
5152
"user"
5253
]
5354
}
@@ -89,12 +90,13 @@
8990
}
9091
},
9192
"url": {
92-
"raw": "{{scheme}}://{{host}}{{port}}/users/search",
93+
"raw": "{{scheme}}://{{host}}{{port}}/v1/users/search",
9394
"protocol": "{{scheme}}",
9495
"host": [
9596
"{{host}}{{port}}"
9697
],
9798
"path": [
99+
"v1",
98100
"users",
99101
"search"
100102
]
@@ -137,12 +139,13 @@
137139
}
138140
},
139141
"url": {
140-
"raw": "{{scheme}}://{{host}}{{port}}/user/{{user_id}}",
142+
"raw": "{{scheme}}://{{host}}{{port}}/v1/user/{{user_id}}",
141143
"protocol": "{{scheme}}",
142144
"host": [
143145
"{{host}}{{port}}"
144146
],
145147
"path": [
148+
"v1",
146149
"user",
147150
"{{user_id}}"
148151
]
@@ -188,12 +191,13 @@
188191
}
189192
},
190193
"url": {
191-
"raw": "{{scheme}}://{{host}}{{port}}/user/{{user_id}}",
194+
"raw": "{{scheme}}://{{host}}{{port}}/v1/user/{{user_id}}",
192195
"protocol": "{{scheme}}",
193196
"host": [
194197
"{{host}}{{port}}"
195198
],
196199
"path": [
200+
"v1",
197201
"user",
198202
"{{user_id}}"
199203
]
@@ -227,12 +231,13 @@
227231
}
228232
},
229233
"url": {
230-
"raw": "{{scheme}}://{{host}}{{port}}/user/{{user_id}}",
234+
"raw": "{{scheme}}://{{host}}{{port}}/v1/user/{{user_id}}",
231235
"protocol": "{{scheme}}",
232236
"host": [
233237
"{{host}}{{port}}"
234238
],
235239
"path": [
240+
"v1",
236241
"user",
237242
"{{user_id}}"
238243
]

0 commit comments

Comments
 (0)