-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (38 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
55 lines (38 loc) · 1.38 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# This is a multi-stage Dockerfile and requires >= Docker 17.05
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/
# Go build stage
FROM gobuffalo/buffalo:latest as builder
ENV GOPROXY http://proxy.golang.org
# Install Node.js 18.x (compatible with modern packages)
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs
# Install Go 1.24
RUN wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gz
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
# Install Yarn 1.x (compatible with older Node.js)
RUN curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.19
ENV PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
RUN mkdir -p /src/hackathon
WORKDIR /src/hackathon
# Copy Go modules
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Install dependencies
RUN yarn install
# Build the application
RUN buffalo build --static -o /bin/app
FROM alpine
RUN apk add --no-cache bash
RUN apk add --no-cache ca-certificates
WORKDIR /bin/
COPY --from=builder /bin/app .
# Uncomment to run the binary in "production" mode:
# ENV GO_ENV=production
# Bind the app to 0.0.0.0 so it can be seen from outside the container
ENV ADDR=0.0.0.0
EXPOSE 3000
# Run migrations before starting the application
CMD /bin/app migrate && exec /bin/app