Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
Parisa Samimi committed Mar 21, 2024
1 parent d834987 commit 520a6ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
9 changes: 0 additions & 9 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
FROM golang:1.21 as build

WORKDIR /dist
COPY . .

# Adjust the ARCH if needed - eg amd64 or arm64v8
ENV GOARCH=amd64 CGO_ENABLED=0

RUN go mod download

# Build the binary
RUN go build -v -o app ./main.go && chmod +x app

FROM alpine:latest as production

COPY --from=build /dist /usr/bin

EXPOSE 80

CMD ["app", "serve", "-port=80"]
1 change: 1 addition & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
build:
context: ./frontend
dockerfile: Dockerfile
target: develop
depends_on:
- app
ports:
Expand Down
18 changes: 12 additions & 6 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
FROM node:21.6-alpine3.18

WORKDIR /app

FROM node:21.6-alpine3.18 AS base
WORKDIR /opt/app
COPY . .

RUN npm install

FROM base AS develop
EXPOSE 3000
CMD ["npm", "run", "dev", '--host']

CMD npm run dev --host
FROM base as build
RUN npm run build

FROM base as production
WORKDIR /opt/app
COPY --from=build /opt/app/.output .
EXPOSE 3000
CMD ["npx", "serve", "./public"]

0 comments on commit 520a6ae

Please sign in to comment.