-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 927 Bytes
/
Dockerfile
File metadata and controls
37 lines (27 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Dockerfile for square/sharkey (server).
#
# Building:
# docker build --rm -t square/sharkey-server .
#
# Basic usage:
# docker run -e SHARKEY_CONFIG=/path/to/config -e SHARKEY_MIGRATIONS=/path/to/migration/dir square/sharkey-server
#
# This image only contains the server component of sharkey,
# the client will have to be deployed separately
FROM golang:1.23 as build
WORKDIR /app
COPY go.mod .
COPY go.sum .
# Download dependencies
RUN go mod download
# Copy source
COPY . .
# Build & set-up
RUN cp docker.sh /usr/bin/entrypoint.sh && \
chmod +x /usr/bin/entrypoint.sh && \
go build -buildvcs=false -o /usr/bin/sharkey-server github.com/square/sharkey/cmd/sharkey-server
# Create a multi-stage build with the binary
FROM golang:1.20
COPY --from=build /usr/bin/sharkey-server /usr/bin/sharkey-server
COPY --from=build /usr/bin/entrypoint.sh /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]