-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Since sqlite has problems with CGO=0 compiling, moving to mysql!
- Loading branch information
1 parent
e0187fb
commit afea2a0
Showing
5 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Build the Go API | ||
FROM golang:1.15 AS builder | ||
ADD . /app | ||
WORKDIR /app/ | ||
RUN go mod download | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w" -a -o /main . | ||
|
||
# Build the React app | ||
FROM node:alpine3.10 AS node_builder | ||
COPY --from=builder /app/frontend ./ | ||
# node-sass needs python & others :( | ||
RUN apk --no-cache --virtual build-dependencies add \ | ||
python \ | ||
make \ | ||
g++ \ | ||
bash | ||
RUN yarn install | ||
RUN yarn build | ||
RUN apk del build-dependencies | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
COPY --from=builder /main ./ | ||
COPY --from=node_builder /build ./frontend/build | ||
RUN chmod +x ./main | ||
EXPOSE 8080 | ||
CMD ./main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: '3.7' | ||
services: | ||
app: | ||
build: . | ||
environment: | ||
MYSQL_USER: root | ||
MYSQL_PASS: root | ||
MYSQL_DB: jsonServer | ||
MYSQL_PORT: 3306 | ||
MYSQL_HOST: db_mysql | ||
depends_on: | ||
- database | ||
ports: | ||
- "80:8080" | ||
database: | ||
container_name: db_mysql | ||
image: mysql | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: test_db | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- db-data/:/var/lib/mysql | ||
- $HOME/Desktop/MySQL-Snippets/school.sql:/school.sql | ||
volumes: | ||
db-data: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters