Skip to content

Commit

Permalink
Update configs and simplify Docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
avonbied committed Oct 12, 2023
1 parent 184201e commit b426672
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
13 changes: 6 additions & 7 deletions app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ ENV NODE_ENV ${ENV}
ARG PORT=3000
ENV PORT ${PORT}

ENV YARN_CACHE_FOLDER=/cache/yarn
WORKDIR /home/node/app

COPY package*.json ./

RUN if [ "$NODE_ENV" = "development" ]; \
then yarn install; \
else yarn install --frozen-lockfile --production; \
fi
# Install packages
COPY package*.json yarn.lock ./
RUN --mount=type=cache,target=/cache/yarn \
yarn install

COPY . .

EXPOSE ${PORT}

CMD yarn "$(if [ $NODE_ENV = 'production' ] ; then echo 'start' ; else echo 'dev'; fi)"
CMD ["yarn", "start"]
2 changes: 1 addition & 1 deletion app/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import sitemap from '@astrojs/sitemap';
export default defineConfig({
site: 'https://avonbied.github.io',
integrations: [sitemap()],
port: (process.env.PORT ?? 8080),
server: {
port: (+process.env.PORT ?? 8080),
host: true,
},
vite: {
Expand Down
18 changes: 10 additions & 8 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: avonbied-ghpage
services:
gh-page:
site:
build:
context: ./app
args:
NODE_ENV: development
context: app
restart: on-failure
ports:
- 9001:3000
volumes:
- ./app:/home/node/app:rw
- /home/node/app/node_modules
- /home/node/app/.astro
develop:
watch:
- path: app/package.json
action: rebuild
- path: app/
action: sync
target: /home/node/app

0 comments on commit b426672

Please sign in to comment.